GREP style not recognizing my colon

Community Beginner ,
Dec 10, 2020

Copy link to clipboard

Copied

I am currently using: 

\W+|\b(?!(Hello|There)\b)\w+

Which looks like this:

Hello There: You

I tried adding:

\W+|\b(?!(Hello|There|:)\b)\w+

but obviously this didn't work. 😞 haha

I need to amend the grep to include the colon without changing much else about it as it also effects text boxes that don't have colons and are based on other words. Been looking for a while and just not finding a solution. Any help would be appreciated.

TOPICS
How to, Scripting

Views

79

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

GREP style not recognizing my colon

Community Beginner ,
Dec 10, 2020

Copy link to clipboard

Copied

I am currently using: 

\W+|\b(?!(Hello|There)\b)\w+

Which looks like this:

Hello There: You

I tried adding:

\W+|\b(?!(Hello|There|:)\b)\w+

but obviously this didn't work. 😞 haha

I need to amend the grep to include the colon without changing much else about it as it also effects text boxes that don't have colons and are based on other words. Been looking for a while and just not finding a solution. Any help would be appreciated.

TOPICS
How to, Scripting

Views

80

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
Dec 10, 2020 0
Adobe Community Professional ,
Dec 10, 2020

Copy link to clipboard

Copied

If you are adding this grep using javaScript, then you need to keep in mind about Escape character.

If JavaScript then this should be added : "\\W+|\\b(?!(Hello|There|:)\\b)\\w+"

 

If any other way, please elaborate your concern.

 

Best

Sunil

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...
Dec 10, 2020 1
Most Valuable Participant ,
Dec 11, 2020

Copy link to clipboard

Copied

@fquinnc 

Please give us more example text for your Grep.

What you have - and what you want.

 

And please write in which way you want to use your Grep.

Grep Find and Replace?

Grep style in paragraph format?

Grep in a script?

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...
Dec 11, 2020 1
Community Beginner ,
Dec 11, 2020

Copy link to clipboard

Copied

Of course! It's a paragraph style, linking to a character style.

so I have two instances of text. 

1. Hello: there

2. Bye for now

In order to apply the character style to the end of the text I'm using
 \W+|\b(?!(Hello|Bye|for)\b)\w+

Which gives me

1. Hello: there

2. Bye for now

But I'd like to include the colon in the "Hello:"

 

Does that help or do you need more context?

 

 

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...
Dec 11, 2020 0
Most Valuable Participant ,
Dec 11, 2020

Copy link to clipboard

Copied

What is your rule for that?

A single word followed by colon or the first two words?

Or something different?

 

Please explain a bit more in detail. And please give a longer example text (before AND after)

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...
Dec 11, 2020 0