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

Bringing spaces into dimensions

Tagged: ,

Return to Member Forum

  • Author
    Posts
    • #74427
      Dimitri De Bruyn
      Participant

      I tried to use grep to change 100x20x20 mm to change into 100 x 20 x 20 mm

      But all I got is:

      Search
      (\d+)(x)(\d+)(x)(\d+)

      Replace by
      $1~4$2~4$3~4$4~4$5

      But I also want to use it when I’ve got two numbers (100×20) or even with mm or cm

      Change 10x2cm or 100x20mm
      Into 10 x 2 cm or 100 x 20 mm

      Can I do it in one grep or do I have to use two?

    • #74428
      Dimitri De Bruyn
      Participant

      I’ve found how to find mm or cm

      Search:
      (\d+)(x)(\d+)(x)(\d+).?(mm|cm)

      Replace by:
      $1~4$2~4$3~4$4~4$5~6$6

    • #74429
      Dimitri De Bruyn
      Participant

      I even expanded it with not to make a difference between uppercase or lowercase.

      (\d+)((?i)x)(\d+)((?i)x)(\d+).?((?i)mm|cm)

      If it could I like to change the uppercase into lowercase :)

    • #74453
      Aaron Troia
      Participant

      Hey Dimitri,

      You might try something like this to account for fewer or more numbers

      Find: (\d+)((?i)x|cm|mm)
      Replace: $1 $2

    • #74465
      Dimitri De Bruyn
      Participant

      Thanks for the smaller code, but it doesn’t do the job

      For example: 20x20x20cm and 10x30mm
      changes into 20 x20 x20 cm and 10 x30 mm

      And I changed the replace code by $1~s$2 because I don’t want to have regular spaces. I used non-breaking spaces

Viewing 4 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads