[opensource] regex help!

Silas Baronda silas.baronda at gmail.com
Sat Feb 23 12:30:03 EST 2008

Wow thanks a bunch.  That was way easier than I thought.  I'm doing
this in python so I'm guessing that it will work like other POSIX

On Fri, Feb 22, 2008 at 3:55 PM, William (Bill) E. Triest III
<triest.1 at osu.edu> wrote:
> All,
>  Sorry for replying to my own message. I made an error in my first post,
>  so I thought I should clarify it.  Previously I said that the first
>  grouping would allow numbers, but that was only true for the perl
>  regex.  I also realized I didn't explain why it matched very well nor
>  did I point out that it would actually match any string containing that
>  substring.
>  The problem with what I've provided so far is that it could match
>  12baronda.2foo because it contains a matching substring.   In perl you
>  could fix this by perpending the regex with ^ and ending it with $ and
>  according to wikipedia that's true for POSIX regex's but it may not be
>  the case for all regex implementations.
>  Generically:  [a-zA-Z]+\.[0-9]+
>  Also, I think some lastname.n's include hyphens, so you'll want to add
>  them into the regex if that's really what you are trying to match.
>  Also, depending on what you're trying to do with this, I think there are
>  OSU identifiers can take other forms, although it rare (I know magnus
>  definately can, but I thought some of the newer ones could also). If
>  that's what you are trying to match I would suggest trying:
> [a-zA-Z\-]+\.[0-9]+
>  I'll break it down to explain:
>  [a-zA-Z\-]+
>  [] are grouping, and a-z says lowercase letters, A-Z upper case letters
>  I'm not positive on the \- for including the literal hyphen, but try
>  it.  If you only want lowercase letters then just put [a-z] The + at the
>  end tells it to have one or more matching in that group
>  \.  (backslash then a period) means period (backslash to escape it so
>  that its a literal period since period has a special meaning in regex's)
>  [0-9]+ is another character grouping, but this time only digits.  Again
>  the + means one or more numbers
>  tcut.
>  Hope this helps and sorry for multiple posts,
>  Bill
>  Silas Baronda wrote:
>  > I'm looking for a regex that will match say baronda.2 so just
>  > string.xxxx x's being integers.
> > _______________________________________________
>  > Opensource mailing list
>  > Opensource at cse.ohio-state.edu
>  > http://mail.cse.ohio-state.edu/mailman/listinfo/opensource
>  >

More information about the Opensource mailing list