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 – find prices with SKU preceding, but with varying white space types used

Return to Member Forum

  • Author
    Posts
    • #14357048
      Lewis Cooper
      Participant

      Hi all,

      Hoping you can help me. I’m using the ‘find and replace’ script to batch change prices throughout my document. The following example shows a list of prices in sentence form.

      Passt perfekt dazu: – Träger-Top aus Leinen-Jersey in Stahlblau UK34 XX,– €, Leinenhose mit weitem Bein in Aquagrau UN88 XX,– €

      I’ve been using the following, which kind of works but with a kink:

      grep {findWhat:”(UK34.+)XX,~=€?”} {changeTo:”$1139,~=~s€”}
      grep {findWhat:”(UN88.+)XX,~=€?”} {changeTo:”$1169,~=~s€”}

      Looking at the example above, I’m getting UK34’s price in UN88’s place. I think this is because GREP is being greedy and overshooting UK34 and find the last match.

      I’m sure I need to use a ? somewhere to fix this, just not sure where.

      The other thing I’ve noticed, is that the “Any white space” is ignoring ‘non-breaking spaces’ and only picking ‘non-breaking space fixed width’. There has been, and always will be inconsistencies in which of those two spaces is used, so I need to be able to detect either.

      Any ideas? Let me know if you need further clarification on anything.

      Thanks in advance.

    • #14357086
      David Blatner
      Keymaster

      Yes, the ? is important if you want to find the “shortest match”. For example, if you search for U.+X you will find most of that sentence. But if you search for U.+?X then you will find just a small bit of text.

      does find a nonbreaking space for me. So that is strange. But you might also try (“any horizontal space”)

      You might also consider using the number adjuster script:

      Free Script to Change All Numbers in a Document using Math

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
Forum Ads