About Question enthuware.ocpjp.v7.2.1426 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
ETS User

About Question enthuware.ocpjp.v7.2.1426 :

Post by ETS User » Wed Feb 20, 2013 4:51 pm

Do we need to escape "\\d\\d"?

admin
Site Admin
Posts: 7143
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1426 :

Post by admin » Wed Feb 20, 2013 5:39 pm

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".

ArnobDe
Posts: 8
Joined: Tue Jan 27, 2015 3:33 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1426 :

Post by ArnobDe » Fri Mar 13, 2015 2:31 am

0 12 followed by 3d dc 2a b2 3 [matching 2 characters at a time] then please explain 9 23 :?:

admin
Site Admin
Posts: 7143
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1426 :

Post by admin » Fri Mar 13, 2015 5:37 am

Not sure what is your question. The pattern matches 2 consecutive digits not just any two characters.

jagoneye
Posts: 97
Joined: Wed Dec 28, 2016 9:00 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1426 :

Post by jagoneye » Fri Jan 06, 2017 5:12 am

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: Select all

System.out.println("\t yosha");
Output:

Code: Select all

	 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. :)

admin
Site Admin
Posts: 7143
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1426 :

Post by admin » Fri Jan 06, 2017 8:51 am

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!

jagoneye
Posts: 97
Joined: Wed Dec 28, 2016 9:00 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1426 :

Post by jagoneye » Fri Jan 06, 2017 8:56 am

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. :)

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests