Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

all the strings that DON'T finish with -C or -L.

Last post 07-27-2010, 10:18 PM by Aussie Susan. 1 replies.
Sort Posts: Previous Next
  •  07-27-2010, 6:13 PM 70159

    all the strings that DON'T finish with -C or -L.

     

     

     

    Hello everyone,

    I'm a totally newbie to regular expression and I'm working on a project where basically I have a list of strings and I need to remove from the list all of those that finish with "-C" or "-L".

    I think the best way to go is using regular expression but I don't know how to create the expression that matches all the strings that DON'T finish with  -C or -L.

     

    Can anyone help me out with this?

     

    Many thanks and have a nice day, 

     

    SIG 

     

     

     

  •  07-27-2010, 10:18 PM 70162 in reply to 70159

    Re: all the strings that DON'T finish with -C or -L.

    Please read the posting guidelines in the sticky note at the beginning of this forum and provide as much of the requested information as possible. In particular, what is the regex variant you are using (they differ in their capabilities) and can we have a sample of the text you are scanning.

    What you you define as a "string" that may or may not end in "-C" or "-L"? Given, say:

    hi there-c friend

    would this become " friend" or "hi  friend" or what?

    Once we know this, we can create a pattern that matches such as "string" and then add '-[CL]\b' or '-(C|L)\b' or similar to it to make it match only those that end in the specified suffix. This can then be used in a regex "replace" operation.

     

    Susan

View as RSS news feed in XML