Some notes on software development... RSS 2.0
# Tuesday, 05 February 2008

If you need to match a single word from a range of words you can use regular expression Alternation. This syntax uses the pipe (|) to represent the logical OR for matching. Here is a RegEx that only matches on 1 of the 4 words (depending on case sensitivity):

^(word1|word2|word3|word4)$

If you need to also allow a possitive macth on an empty string you can and another pipe (|) with no word after like so:

^(word1|word2|word3|word4|)$

This will match a blank word or either of the words listed.

Tuesday, 05 February 2008 11:40:22 (GMT Standard Time, UTC+00:00)  #    -
Regular Expressions
Navigation

Sign In
Extras
Statistics
Total Posts: 116
This Year: 0
This Month: 0
This Week: 0
Comments: 36
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2017
Hadrian Phillips

All Content © 2017, Hadrian Phillips
DasBlog theme 'Business' created by Christoph De Baene (delarou)