• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How do you find numbers with a period

Explorer ,
Oct 07, 2016 Oct 07, 2016

Copy link to clipboard

Copied

FM - 2015 - Unstructured - Win 10

Using a Wildcard search, how do you find numbers with a period. Like 111.22 or 1.33 or 334566.9877665?

Views

372

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 08, 2016 Oct 08, 2016

Copy link to clipboard

Copied

[0-9].[0-9]

with

☑ Use Wildcards

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 08, 2016 Oct 08, 2016

Copy link to clipboard

Copied

LATEST

The example from Bob Niland (Error 7103) works for some of your examples, but not all. The results are a little bit unpredictable because of the "." which is a reserved character in RegEx. It will not always find the "." itself, and never the whole number.

To find always "one number+dot+one number" you will need to "escape" the dot with a backslash:

[0-9]\.[0-9]

This will find the following in your examples:

111.22

1.33

334566.9877665

If you want to find the whole number including the dot, you will need to add a "possessive quantifier". A possessive quantifier extends the search "As many times as possible, without giving back":

[0-9]++\.[0-9]++

This will find the following in your examples:

111.22

1.33

334566.9877665

A slightly more elegant version of the same is this:

\d++\.\d++

(\d is the shorthand character class for "digit")

Now, maybe you want to find and replace all these dot's with a comma? Easy: Just wrap the digit groups into a "numbered capturing group" by putting them into (brackets) Like this.

(\d++)\.(\d++)

Each of these (groups) will have an "internal" number: 1, 2 etc.

Now you can reference these groups in the "Change" text field with $# and replace the dot with a comma. Like this:

Find: (\d++)\.(\d++)

Change: $1,$2

This will find all of your examples and replace the "." in them with a ",".

Result:

111,22

1,33

334566,9877665

You might also find the post on the Adobe TechComm Blog by Marek Pawelec interesting: “Do the magic: Regular Expressions in FrameMaker”

Also, if you want to get deeper into RegEx, you might find the small tool "RegexBuddy" very helpful, to build complex regular expressions. It can be something extremely powerful!

Hope that helps 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines