in reply to Concatenating regexs?

not easily, since they all do quite different things... much easier as you have it, but if you are diong them often maybe you should look into using qr{} to precompile the regexps...

also, you realize that $print =~ s/([a,e,O])I/\1j/g; matches , as well as a e and O? if you don't want to match comma use [aeO] [] is a character class, so it looks at characters, so a separator is not necessary.

also I believe that using $1 in the second half of the substitution is preferred to \1... perl -w would tell you that...

you can do $print =~ s/([b-zA-Z]):/\1/g; which should be much faster than $print =~ s/([b-z]|[A-Z]):/\1/g; character classes can have as many ranges as you want in them.... but the (|) will slow you down compared to a straight character class...

Update Oops... 9|3: does match 9 or 3:... my bad, ignore the next line
not sure, do you want 9|3: to match '9|3:' or do you want it to match '9' or '3:'... it will match the former...
                - Ant

Replies are listed 'Best First'.
Re: Re: Concatenating regexs?
by Micz (Beadle) on May 04, 2001 at 18:56 UTC
    thanks for your help, I have a lot to learn. I have taken the first points and used them. How would I find either '9' or '3:' ? using 9\|3: ? thanks again, jan
      Ack! oops, sorry... my bad /9|3:/ will do the or...
                      - Ant