• Post Reply Bookmark Topic Watch Topic
  • New Topic

regex  RSS feed

 
Ann Joyce
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to get a regex for everything from R2-R198.
I have
R[2-9]?R[0-9]?R[0-9].. but this doesn't include 10 ,11 etc..
I want everything that will meet R2,R3,R4,R5,R6,R7,R8...R198
Any ideas?
 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
R and one digit, not [0-1], R and two digits, R and 1 and two digits, not 99

Would that help?

[edit]Change numbers to words[/edit]
 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I would write a regex for that. It would depend on whether the requirements were likely to change. It might happen that I spent a couple of hours writing that regex and setting up unit tests for it, and then two months later they changed it to "R2-R237". In this case changing the non-regex code I have in mind would be pretty trivial, but writing a new regex for that rule might be less than trivial.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!