All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: About Question enthuware.ocpjp.v7.2.1426 :
PostPosted: Wed Feb 20, 2013 4:51 pm 
Do we need to escape "\\d\\d"?


Top
  
 
 Post subject: Re: About Question enthuware.ocpjp.v7.2.1426 :
PostPosted: Wed Feb 20, 2013 5:39 pm 
Offline
Site Admin

Joined: Fri Sep 10, 2010 9:26 pm
Posts: 6069
No, the additional '\' is required only when you are using a special character within a string in the code. For example, "\\t is for tab". If you don't put \\ here, you will get " is for tab".


Top
 Profile Send private message  
 
 Post subject: Re: About Question enthuware.ocpjp.v7.2.1426 :
PostPosted: Fri Mar 13, 2015 2:31 am 
Offline

Joined: Tue Jan 27, 2015 3:33 pm
Posts: 8
0 12 followed by 3d dc 2a b2 3 [matching 2 characters at a time] then please explain 9 23 :?:


Top
 Profile Send private message  
 
 Post subject: Re: About Question enthuware.ocpjp.v7.2.1426 :
PostPosted: Fri Mar 13, 2015 5:37 am 
Offline
Site Admin

Joined: Fri Sep 10, 2010 9:26 pm
Posts: 6069
Not sure what is your question. The pattern matches 2 consecutive digits not just any two characters.


Top
 Profile Send private message  
 
 Post subject: Re: About Question enthuware.ocpjp.v7.2.1426 :
PostPosted: Fri Jan 06, 2017 5:12 am 
Offline

Joined: Wed Dec 28, 2016 9:00 am
Posts: 97
admin wrote:
No, the additional '\' is required only when you are using a special character within a string in the code. For example, "\\t is for tab". If you don't put \\ here, you will get " is for tab".

What? It runs fine with a single '\' in this statement for example:
Code:
System.out.println("\t yosha");

Output:
Code:
    yosha

you can use single '\' for special characters like
b t n r " ' \.
Only for regex you need to escape the '\' because '\s' is required for example but in
Java String you need to escape '\' with '\' hence the String will be '\\s'.
Hope I'm not wrong. :)


Top
 Profile Send private message  
 
 Post subject: Re: About Question enthuware.ocpjp.v7.2.1426 :
PostPosted: Fri Jan 06, 2017 8:51 am 
Offline
Site Admin

Joined: Fri Sep 10, 2010 9:26 pm
Posts: 6069
You are right \\ is only required in a string for regex patterns because you want to let \ be a part of the regex.
thank you for your feedback!


Top
 Profile Send private message  
 
 Post subject: Re: About Question enthuware.ocpjp.v7.2.1426 :
PostPosted: Fri Jan 06, 2017 8:56 am 
Offline

Joined: Wed Dec 28, 2016 9:00 am
Posts: 97
admin wrote:
You are right \\ is only required in a string for regex patterns because you want to let \ be a part of the regex.
thank you for your feedback!

You are welcome. :)


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Template made by DEVPPL/ThatBigForum