• 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
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Question in regex

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Ranchers


Can someone explain me in regex a . (dot) is considered a metacharacter without preceding \\ but.(d->digit,s->space,w->word character) are considered metacharacter by putting preceding \\ i.e \\d \\w \\s

Why is it so?
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
If you simply right "d" "w" or "s" it would mean that you are trying to find these srtings in the given pattern.
But, when you put a "." in the matcher, then it means that you are trying to fit in any character.
If you want to find the "." character, then you will have to preceed it with / or //

If you want to find digits words or whitespace then you will have to preceed the "d" "w" or "s" with a / or //

Point out if I am wrong on this.
Regards.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic