About Question enthuware.ocpjp.v7.2.1182 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
renatumb
Posts: 47
Joined: Mon Apr 08, 2013 7:55 pm
Contact:

About Question enthuware.ocpjp.v7.2.1182 :

Post by renatumb »

String str = "she sells sea shells";
String rex = "\\Ss\\S";

Explanation:
Therefore, \\Ss\\S matches any s that is surrounded by a non white space character on both sides.
Why doesn't it found the first and last 's' on this string ? So they are not surrounded by space

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

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

Post by admin »

\\S means non-white space. Word boundary is not considered as non-white space.

HTH,
Paul.

renatumb
Posts: 47
Joined: Mon Apr 08, 2013 7:55 pm
Contact:

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

Post by renatumb »

admin wrote:\\S means non-white space. Word boundary is not considered as non-white space.

HTH,
Paul.
Do you mean word-boundary is considered a white space ?

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

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

Post by admin »

No, this particular word boundary is just a word boundary :) Neither whitespace nor non whitespace.
All white spaces are considered word boundaries but not the reverse.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 7 guests