• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

WhizLabs Regex Question

 
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

Can anyone explain how the below code works ?


Thanks.
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)?
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic