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

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

Enthusiast ,
Jul 24, 2020 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

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

Views

182

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

correct answers 1 Correct answer

Community Expert , Jul 25, 2020 Jul 25, 2020

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.

Votes

Translate

Translate
Community Expert ,
Jul 25, 2020 Jul 25, 2020

Copy link to clipboard

Copied

LATEST

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.

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