Jump to content

regular Expression


Recommended Posts

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

Link to post
Share on other sites
  • Developers

this script can do the test for you:

$a="9999999999"

$b="99-99999999"

If StrTest($a,$:whistle:=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 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.
  :)

Link to post
Share on other sites
  • 11 months later...

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 Nuttall
Nuttall 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...

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...