• Post Reply Bookmark Topic Watch Topic
  • New Topic

RegEx pattern  RSS feed

 
kri shan
Ranch Hand
Posts: 1489
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RegEx pattern for these Strings - one.two.three (or) onew.twos.trhhee.sdfour (or) fsdf.abcdr.trew.jffgh.qacd

This does not work  ((?:[a-z][a-z]+))
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Regular expression is more than just a pattern. How are you using it? find()? matches()? split()? replaceAll()? etc. etc. etc.

Perhaps you can elaborate a bit?

Henry
 
Stelios Ntilis
Greenhorn
Posts: 2
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you need something like this i suppose:
([a-z][.a-z]+)
 
Tim Moores
Saloon Keeper
Posts: 4024
94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you describe in words what you want to match? Is it "a sequence of lowercase letters, interspersed by dots, with at least one letter between dots"? If so, the dot should appear somewhere in the pattern (keeping in mind that a dot is a special pattern, and thus needs to be escaped to match a literal dot).
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
an example is terrific, but it is not a spec. This regex will work for your example, but it's almost without a doubt not what you want:

one\.two\.three|onew\.twos\.trhhee\.sdfour|fsdf\.abcdr\.trew\.jffgh.qacd

without a spec, you can't tell me the above is NOT what you want.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!