Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

WhizLabs Regex Question

 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Can anyone explain how the below code works ?


Thanks.
 
Tamara Lopez
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This question confused me too
(?i) turns on case insensitivity - so it will find any sequence of ill or ILL followed by a number. If you take out the (?i) it will only replace the hill2 bit.
I dont think we need to know the case insensitivity one for the exam.... there are a lot of questions that seem to have extra things in whizlabs.
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure Tamara,

There's extra things charged in WhizLabs simulator.

I was able to understand how the "ill\\d" pattern works but I was unable to determine how the pattern "(?i)" works.

So, let's concentrate our analisys in "(?i)" pattern. Could you please Tamara explain step-by-step how the "(?i)" pattern works ?

As far as I know the pattern "?" means zero or one occurrences, so I'm unable to determine how can it mean about Case Sensitive.

Thanks.
 
Tamara Lopez
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just looked it up and its what it said. To mean one or zero it would be after the character: eg: \\d* or \\d? or ([a-bA-b])+
Check for eg this page out:
http://www.regular-expressions.info/java.html

if you had i? that would mean zero or one i. or (i)?
 
Joyce Lee
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

(?i) is an embedded flag expression.

Check out the following page for more info:
http://java.sun.com/docs/books/tutorial/extra/regex/pattern.html

Joyce
 
Edisandro Bessa
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh yeah. Now I see.

Embedded Flag Expression. That's the point.

Thank you so much for your prompt replies.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic