LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Using regex to format a string

    Employee
    Posted 01-24-2013 04:14

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stunelson

    Having never used a REGEX command previously I'm struggling to understand the syntax and how I use it in LAE.
    What I am looking to do is take string "United_States-of|America+2013" and replace all non alphanumeric characters with a space which should leave
    me with "United States of America 2013" - I'm sure it is fairly straightforward but a little assistance would be appreciated. Thanks.


  • 2.  RE: Using regex to format a string

    Employee
    Posted 01-24-2013 05:19

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    For a full reference on Regular Expressions, check http://perldoc.perl.org/perlre.html
    For a "quick guide" check http://en.wikipedia.org/wiki/Regular_expression

    For the particular thing you are trying to do, this should work:

    s=regexSubstitute(column,"[^A-Za-z0-9]"," ")


  • 3.  RE: Using regex to format a string

    Employee
    Posted 01-24-2013 05:33

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stunelson

    Originally posted by: stonysmith
    					

    For a full reference on Regular Expressions, check http://perldoc.perl.org/perlre.html
    For a "quick guide" check http://en.wikipedia.org/wiki/Regular_expression

    For the particular thing you are trying to do, this should work:

    s=regexSubstitute(column,"[^A-Za-z0-9]"," ")
    Thanks, this is perfect!
    I was slightly out with my brackets.