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: Finding Zero

Tagged: 

Return to Member Forum

  • Author
    Posts
    • #79378
      Janessa
      Member

      Hello,
      I would like to find a single digit of 0 within a table, to replace with an en-dash. In my searching I have not yet come across a way to do this.. and it seems like something that would be incredibly simple. I’m able to find (0) but things start to get complicated when trying to find the single digit. I have used negative look ahead/behind but, so far, I’m either not getting any results or the search is picking up 0.9’s or 12.0’s… which I don’t want.

      I tried the following
      (?<!.)0(?!.)

      But, again, it picked up nothing. Would someone be able to assist?

      Thanks,

    • #79385
      Aaron Troia
      Participant

      Not sure if this will find everything by try:

      \W\K0(?!\w)

    • #79411
      Janessa
      Member

      A. A. Ron, thanks for your reply.

      Your suggestion pulls up the solo 0’s, but also 0’s with periods before and after. (For example: 0.9, 100.0, etc.)
      Would you know of a way to get the solitary 0’s only?

      Thanks again,

      • #79453
        Peter Kahrel
        Participant

        In your (?<!.)0(?!.) the dot stands for ‘everything’. Try (?<!\.)0(?!\.) and see what happens. If there are more exclusions, do them as classes, as in (?<![\.,(])0(?![\.,)])

        Peter

    • #79463

      If it’s just a “0” and nothing else within a table cell, you could use
      ^0$
      or
      \A0\Z

      Cheers
      Rudi

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