Results 1 to 3 of 3

Thread: Regular Expression Experts?

  1. #1
    almost retired the-mk's Avatar
    Join Date
    Jan 2003
    Location
    KI/OOE/Austria
    Posts
    1,921
    Blog Entries
    6

    Regular Expression Experts?

    Are there some regular expression experts out there?

    I have a software, which uses regular expressions as check mechanism on how a string should look like. I want to achieve that only "standard characters" are "valid", but no character which a file system doesn't like...

    currently this one makes me headache:
    Code:
    %^[-A-Za-z0-9" "_]{1,40}
    can someone explain me what these things mean?
    the things in the brackets should mean the following characters: "-", characters from A to Z (upper and lower case), numbers from 0 to 9, " " (blank) and "_" (underscore)
    {1,40} should mean from first sign to sign number forty. Is this still regular expression?
    %^ --> what should that mean?

    can someone please bring light into that thing to me?

    Thanks in advance!
    the-mk

  2. #2
    Free-DC Semi-retire gopher_yarrowzoo's Avatar
    Join Date
    Mar 2002
    Location
    Santa Ana, CA
    Posts
    3,980
    I'm no reg exp expert but I've had a quick shifty at a program I used that uses reg exp for search
    Code:
    %^ - start of line
    [-A-Za-z0-9" "_] - match "A-Z","a-z","0-9"," " & "_" also match "-" might want to put the - as "-" to make sure
    {1,40} - can't see in the version I use so idea if it will work but in mine it an "expression" on in it's own right, looking at it I can now see it's of PCRE type so it should work.
    Also add "." as "dot" is a valid char.
    Semi-retired from Free-DC...
    I have some time to help.....
    I need a new laptop

  3. #3
    Administrator Bok's Avatar
    Join Date
    Oct 2003
    Location
    Wake Forest, North Carolina, United States
    Posts
    22,163
    Blog Entries
    13
    Most likely the {} are line numbers ? i.e. match line 1 - 40

    Hard to tell from the context though.

    Gopher has the rest of the regexp correct.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •