Guest sjana Posted December 23, 2003 Posted December 23, 2003 I want to check if all digits in a string are same. E.G. my valid sets are 1. 9999999999 2. 99-99-99999 The regexp which I could come up is ^[0-9]\1+$ The above regexp match 1. but cant match 2. I need a regexp which can match both 1. and 2. thanks in advance
Developers Jos Posted December 24, 2003 Developers Posted December 24, 2003 (edited) this script can do the test for you: $a="9999999999" $b="99-99999999" If StrTest($a,$=1 then msgbox(0,"","$a is Equal to $b") else msgbox(0,"","$a Not Equal to $b") endif Func StrTest($S1,$S2) $ignore="-,/,$" ; Place here the chars to ignore $chars=StringSplit($ignore,",") ; $S2b=$S2 ; Fill teststring ; Remove all specified Ignore characters from the Test string For $x = 1 to $chars[0] $S2b = StringReplace($S2b,$chars[$x],"") next If $S1=$S2b then return 1 return 0 endfunc Edited December 24, 2003 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Guest sjana Posted December 24, 2003 Posted December 24, 2003 Thanks for the reply, however my requirement is a single regular expression rather than a function. Basically i need it as part of struts validation.
Nutster Posted December 17, 2004 Posted December 17, 2004 The back-referencing you are asking for is on the TO DO list. I am trying to get more fundemental fixes done, before implementing it. I will be at my parent's place from Dec 22 to Jan 4, so very little development (but much relaxation) will occur then. I hope to get things finshed on the weekend and submit to Jon on Monday or Tuesday. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now