Results 1 to 3 of 3
Thread: regular expression question
- 05-18-2012, 07:14 AM #1
Senior Member
- Join Date
- Jan 2012
- Posts
- 142
- Rep Power
- 0
regular expression question
If the question was there are three items A, B, and C, and the user can pick any one of these items, however hte user must pick at least 3 and no more than 20 would the following work?
[A|B|C] [A|B|C] [A|B|C] [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]? [A|B|C]?
I know there is a way t make it shorter, but for now would this accept the correct entries?
Thanks
- 05-18-2012, 08:09 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,380
- Blog Entries
- 7
- Rep Power
- 17
Re: regular expression question
Note that those spaces are significant ...
kind regards,
JosLast edited by JosAH; 05-18-2012 at 06:02 PM. Reason: fixed a non-sentence.
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 05-18-2012, 11:30 AM #3
Re: regular expression question
The pipe character | has no special significance inside a character class.
Recommended learning resources:
Pattern (Java Platform SE 7 )
Lesson: Regular Expressions (The Java™ Tutorials > Essential Classes)
Regular-Expressions.info - Regex Tutorial, Examples and Reference - Regexp Patterns
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Regular expression question
By stuckonjava in forum New To JavaReplies: 6Last Post: 05-11-2012, 04:11 AM -
regular expression
By ehsansad in forum New To JavaReplies: 8Last Post: 03-18-2011, 02:23 PM -
regular expression
By prof.deedee in forum JDBCReplies: 3Last Post: 02-19-2010, 11:15 AM -
regular expression
By QkrspCmptPop in forum Advanced JavaReplies: 8Last Post: 01-20-2010, 03:55 AM -
regular expression
By ras_pari in forum Advanced JavaReplies: 27Last Post: 10-07-2009, 12:25 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks