Highlighted

Why is this regular expression executed only once for a paragraph. Back reference

Explorer ,
Jul 24, 2020

Copy link to clipboard

Copied

Why is this regular expression executed only once for a paragraph.

I want to find the [] that is not at the beginning of the paragraph
Expression: (?<!^)+(\[\d+\])

--------------------------------------------------------------------------------------------
For example, in the second paragraph, it ends when you find [3], and [4] cannot be found. I hope to find and replace all the matches in this paragraph one by one

Adobe Community Professional
Correct answer by Peter Kahrel | Adobe Community Professional

Use this:

.\K(\[\d+\])

i.e. look for [\d] preceded by any character, which is equivalent to 'look for [\d] not at the start of the paragraph'.

P.

TOPICS
Bug, Feature request, How to, Scripting, Type

Views

56

Likes

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

Why is this regular expression executed only once for a paragraph. Back reference

Explorer ,
Jul 24, 2020

Copy link to clipboard

Copied

Why is this regular expression executed only once for a paragraph.

I want to find the [] that is not at the beginning of the paragraph
Expression: (?<!^)+(\[\d+\])

--------------------------------------------------------------------------------------------
For example, in the second paragraph, it ends when you find [3], and [4] cannot be found. I hope to find and replace all the matches in this paragraph one by one

Adobe Community Professional
Correct answer by Peter Kahrel | Adobe Community Professional

Use this:

.\K(\[\d+\])

i.e. look for [\d] preceded by any character, which is equivalent to 'look for [\d] not at the start of the paragraph'.

P.

TOPICS
Bug, Feature request, How to, Scripting, Type

Views

57

Likes

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
Jul 24, 2020 0
Adobe Community Professional ,
Jul 25, 2020

Copy link to clipboard

Copied

Use this:

.\K(\[\d+\])

i.e. look for [\d] preceded by any character, which is equivalent to 'look for [\d] not at the start of the paragraph'.

P.

Likes

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
Reply
Loading...
Jul 25, 2020 1