Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Grep problem

Return to Forums

  • Author
    Posts
    • #64234
      Nownow57
      Member

      Hi everyone,

      I am sorry to bother you but I need your help concerning a grep request which don't really work.

      I am trying to find all the terms containing the term “eg”, “e.g”, “eg.”, “e.g.” and “e.g.,” and replace them by “e.g.,”

      Here is the Grep request : (e)(.)?(g)(.)?(,)*s*?

      which is replaced by : e.g.,~s

      But my problem is that the request also finds terms containing in words like “regex” and I don't understand why … where is my mistake ? I tried to use the terms < and > to delimitate he beginning and the end of the word but if I do this, the coma and dots aren't selected …

      Thank you in advance for your help.

    • #64236
      David Blatner
      Keymaster

      Does this work?

      <e.?g.?>

      (My guess is that you had backslashes in your post, but our forum eats them. You need to type backslash twice in a row or else they disappear here.)

    • #64252
      Nownow57
      Member

      Indeed, here is the correct GREP request I have :

      (e)(.)?(g)(.)?(,)*s*

      Thanks for your help … Unfortunately, the GREP you gave me works but doesn't find any dot, comma or space(s) after the “g”

    • #64259
      David Blatner
      Keymaster

      To add the comma, just add a ,? at the end. The question mark means “zero or one” instances of the previous character.

    • #64260
      Nownow57
      Member

      I already tried but the problem isn't solved : indeed, a word like “regex” is always recognized in the request whereas it shoudln't be ;___; I really don't know where the problem is … I tried a lot of combinaisons but none of them worked …

    • #64261
      David Blatner
      Keymaster

      Huh? Did you use the backslash-angle-brackets at the beginning and end? Those are word boundaries. Or you could put a backslash-b at both sides, which should also work.

    • #64262
      Nownow57
      Member

      I finally find the solution :)

      <e.*g.*,*

      Thanks for your help

Viewing 6 reply threads
  • You must be logged in to reply to this topic.
Forum Ads