Results 1 to 10 of 10
Thread: Pattern
- 04-06-2009, 09:53 AM #1
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
Pattern
i have a Pattern ([_a-zA-Z]+[_0-9a-zA-Z-/]*[_0-9a-zA-Z]+)
would catch general valid .... let said uri without file extension
how can modify the pattern so that i would not match pattern ... let said ... "abc/ccd"?Last edited by mtyoung; 04-06-2009 at 11:33 AM.
- 04-06-2009, 12:19 PM #2
Member
- Join Date
- Feb 2009
- Posts
- 22
- Rep Power
- 0
Well, ([_0-9a-zA-Z-/]*) is enough for your business.
Now if u dont want "/" in your pattern just remove it
i.e. ([_0-9a-zA-Z-]*)
- 04-06-2009, 12:28 PM #3
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
faisalcmpm... why [_0-9a-zA-Z-/]* is enough? we should not accept input like "///aaa///aaa//"
if remove "/", it can only handle the last part of uri... you know...
current situation is "abc/ccd" matches [_a-zA-Z]+[_0-9a-zA-Z-/]*[_0-9a-zA-Z]+
but i want to modify the pattern so that "abc/ccd" will not match but "abcd/ccd" still match the patternLast edited by mtyoung; 04-06-2009 at 12:32 PM.
- 04-06-2009, 01:52 PM #4
Member
- Join Date
- Feb 2009
- Posts
- 22
- Rep Power
- 0
Sorry..
The thing is that am not that much expert in URI syntax.
Still i didn't get your actual issue.
U wants to mach "abc/ccd" but not "abcd/ccd" ,
means u want to restrict the alphabet count to 3?
- 04-06-2009, 04:34 PM #5
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
not related to uri syntax...
i want to match most of pattern, ([_a-zA-Z]+[_0-9a-zA-Z-/]*[_0-9a-zA-Z]+)
but in some of special pattern... may be a123/ccd, gae24edwegt34r/546/3246/1312 , i want them not to match
so... my question is how to modify the ([_a-zA-Z]+[_0-9a-zA-Z-/]*[_0-9a-zA-Z]+) pattern, so that so pattern(self define maybe d25/232/afasdf/dfa will not match it)
- 04-06-2009, 04:44 PM #6
For a specific example, just handle them outside of the pattern - i.e. if you match one then ignore it.
There's nothing you can do in the pattern unless you can characterise the pattern of strings you want to exclude.
- 04-06-2009, 04:52 PM #7
Member
- Join Date
- Feb 2009
- Posts
- 22
- Rep Power
- 0
I agree with OrangeDog.
U have to have a kind of similarity in those inputs which u want to exclude. Then only u can take advantage of Pattern
- 04-06-2009, 05:29 PM #8
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
[^snv] will not include s, n, v
so is there any method to exculde String, not char?
- 04-06-2009, 06:21 PM #9
In short, no. Regular expression work on a character-by-character basis.
- 04-07-2009, 02:17 AM #10
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
Similar Threads
-
Star pattern help?
By GeeKunMow in forum New To JavaReplies: 13Last Post: 07-21-2011, 05:59 AM -
MVC Pattern
By bubbless in forum New To JavaReplies: 12Last Post: 03-14-2009, 09:15 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks