Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

metacharacter- regex

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


The output is :
start: 14 group: ab.

Why does . not behave as a metacharacter.

If then it behaves like metacharacter giving the output:
start: 3 group: abc

start: 9 group: abd

start: 14 group: ab.

start: 17 group: ab1

which I expected from previous pattern as well.

In a similar way I tried
and both of which result in same output i.e :
start: 17 group: ab1 giving indication that \d behaves correctly as metacharacter.
So why not dot(.) ?

(I think I have fixed problem with formatting (see next post))
[ September 23, 2006: Message edited by: Barry Gaunt ]
 
joshua antony
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry,

pattern used are:

String x = "[a][b][.]";
String x = "[a][b].";
String x = "[a][b][\\d]";
String x = "[a][b]\\d";

I do not know how did I leave [b] in many places.
 
reply
    Bookmark Topic Watch Topic
  • New Topic