Regex question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hardy Wang

    #1

    Regex question

    Hi:
    How to write a pattern to find strings which do not contain some certain
    string?
    For example, I need to search all strings without "abc" in them.

    Thanks!

    --
    WWW: http://hardywang.1accesshost.com
    ICQ: 3359839
    yours Hardy


  • AlexS

    #2
    Re: Regex question

    So, check if string has "abc" inside and skip it if it has.

    Why this doesn't work for you?

    HTH
    Alex

    "Hardy Wang" <hardy_wang@mar ketrend.com> wrote in message
    news:OzCS4wvnDH A.2776@tk2msftn gp13.phx.gbl...[color=blue]
    > Hi:
    > How to write a pattern to find strings which do not contain some[/color]
    certain[color=blue]
    > string?
    > For example, I need to search all strings without "abc" in them.
    >
    > Thanks!
    >
    > --
    > WWW: http://hardywang.1accesshost.com
    > ICQ: 3359839
    > yours Hardy
    >
    >[/color]


    Comment

    • Vadym Stetsyak

      #3
      Re: Regex question

      you can use
      (?!abc)

      "Hardy Wang" <hardy_wang@mar ketrend.com> wrote in message
      news:OzCS4wvnDH A.2776@tk2msftn gp13.phx.gbl...[color=blue]
      > Hi:
      > How to write a pattern to find strings which do not contain some[/color]
      certain[color=blue]
      > string?
      > For example, I need to search all strings without "abc" in them.
      >
      > Thanks!
      >
      > --
      > WWW: http://hardywang.1accesshost.com
      > ICQ: 3359839
      > yours Hardy
      >
      >[/color]


      Comment

      • AlexS

        #4
        Re: Regex question

        Does it work for you?

        Not for me. I wonder why?


        "Vadym Stetsyak" <pdsdev@ukr.net > wrote in message
        news:%23aW8Snyn DHA.2772@TK2MSF TNGP12.phx.gbl. ..[color=blue]
        > you can use
        > (?!abc)
        >
        > "Hardy Wang" <hardy_wang@mar ketrend.com> wrote in message
        > news:OzCS4wvnDH A.2776@tk2msftn gp13.phx.gbl...[color=green]
        > > Hi:
        > > How to write a pattern to find strings which do not contain some[/color]
        > certain[color=green]
        > > string?
        > > For example, I need to search all strings without "abc" in them.
        > >
        > > Thanks!
        > >
        > > --
        > > WWW: http://hardywang.1accesshost.com
        > > ICQ: 3359839
        > > yours Hardy
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Brian Davis

          #5
          Re: Regex question

          Try this instead:

          ^((?!abc).)*$


          Brian Davis



          "AlexS" <salexru2000NO@ SPAMsympaticoPL EASE.ca> wrote in message
          news:uA2RZU2nDH A.2304@TK2MSFTN GP11.phx.gbl...[color=blue]
          > Does it work for you?
          >
          > Not for me. I wonder why?
          >
          >
          > "Vadym Stetsyak" <pdsdev@ukr.net > wrote in message
          > news:%23aW8Snyn DHA.2772@TK2MSF TNGP12.phx.gbl. ..[color=green]
          > > you can use
          > > (?!abc)
          > >
          > > "Hardy Wang" <hardy_wang@mar ketrend.com> wrote in message
          > > news:OzCS4wvnDH A.2776@tk2msftn gp13.phx.gbl...[color=darkred]
          > > > Hi:
          > > > How to write a pattern to find strings which do not contain some[/color]
          > > certain[color=darkred]
          > > > string?
          > > > For example, I need to search all strings without "abc" in them.
          > > >
          > > > Thanks!
          > > >
          > > > --
          > > > WWW: http://hardywang.1accesshost.com
          > > > ICQ: 3359839
          > > > yours Hardy
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          Working...