How do you match a hash character "#" in GREP?

Explorer ,
Oct 09, 2020 Oct 09, 2020

Copy link to clipboard

Copied

How do you match a hash character "#" in GREP? If I enter the symbol directly it is not seen as an ordinary character. I have tried with quotes and with a backslash as an escape, but to no avail.

 

Jason

TOPICS
How to

Views

120

Likes

translate

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

Adobe Community Professional , Oct 09, 2020 Oct 09, 2020
I think the issue is with the use of \b, it will look for position after # and hence it won't match. Try something like the following \b(return|function)\b|#include\b -Manan  

Likes

translate

Translate

Translate
Explorer ,
Oct 09, 2020 Oct 09, 2020

Copy link to clipboard

Copied

Here is basically what I have so far:

\b(return|#include|function)\b

This will match the strings return and function, but not the string #include.

Likes

translate

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 Community Professional ,
Oct 09, 2020 Oct 09, 2020

Copy link to clipboard

Copied

I think the issue is with the use of \b, it will look for position after # and hence it won't match. Try something like the following

\b(return|function)\b|#include\b

-Manan

 

Likes

translate

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
Explorer ,
Oct 09, 2020 Oct 09, 2020

Copy link to clipboard

Copied

Thanks

Likes

translate

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