Highlighted

How can I use lookahead/lookbehind one segment at a time!

Contributor ,
Jun 18, 2020

Copy link to clipboard

Copied

Here is an example of the raw text:

 

At the time her design became the mascot, Murphy was featured in the [i]ReminderNews[/i], which was later acquired by The [i]Hartford Courant[/i] in 2014, and later renamed [i]Courant Community[/i].

 

Latest lame attempt to "catch" the middle characters, then use Found Text to change them to ital:

(?<=(\[i\])).+(?=(\[\/i\]))

My problem is that it keeps selecting all the text end to end.  I can't seem to have the "Match" commands stop and format stop and format.  Now, my brain hurts and hoping someone can straighten out my game.

 

MadMac55_0-1592515243910.png

 

You can achieve it in one query...

Find: \[i\](.+?)\[\/i\]
Change: $1

TOPICS
Print, Scripting

Views

129

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

How can I use lookahead/lookbehind one segment at a time!

Contributor ,
Jun 18, 2020

Copy link to clipboard

Copied

Here is an example of the raw text:

 

At the time her design became the mascot, Murphy was featured in the [i]ReminderNews[/i], which was later acquired by The [i]Hartford Courant[/i] in 2014, and later renamed [i]Courant Community[/i].

 

Latest lame attempt to "catch" the middle characters, then use Found Text to change them to ital:

(?<=(\[i\])).+(?=(\[\/i\]))

My problem is that it keeps selecting all the text end to end.  I can't seem to have the "Match" commands stop and format stop and format.  Now, my brain hurts and hoping someone can straighten out my game.

 

MadMac55_0-1592515243910.png

 

You can achieve it in one query...

Find: \[i\](.+?)\[\/i\]
Change: $1

TOPICS
Print, Scripting

Views

130

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
Jun 18, 2020 0
Contributor ,
Jun 18, 2020

Copy link to clipboard

Copied

Tada!   Knew it was in ther somewhere (shortest match!!)

 

(?<=(\[i\]))(.*?)(?=(\[\/i\]))

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...
Jun 18, 2020 0
Advocate ,
Jun 18, 2020

Copy link to clipboard

Copied

No need to put them into a sub-expression or use the * (unless you want to catch empty text like [i][/i]).

(?<=\[i\]).+?(?=\[\/i\])

 

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...
Jun 18, 2020 1
Contributor ,
Jun 18, 2020

Copy link to clipboard

Copied

My first GREP grabs the words and applies the italics.

Another GREP that follows removes the markup left behind.

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...
Jun 18, 2020 0
Advocate ,
Jun 18, 2020

Copy link to clipboard

Copied

You can achieve it in one query...

Find: \[i\](.+?)\[\/i\]
Change: $1

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...
Jun 18, 2020 2
MadMac55 LATEST
Contributor ,
Jun 18, 2020

Copy link to clipboard

Copied

Oh, that's more elegant.   Thank you Jean-Claude!!

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...
Jun 18, 2020 0