Page 1 of 1

Using a hash symbol (#) but not for comment

Posted: Fri Aug 30, 2024 4:06 pm
by kaveh1000
I should know this but I need to replace some text with a string that includes a # character. How can I override its normal use as a comment? e.g. part of string is:

Code: Select all

...color=\"\#FF0000\"\>...

Re: Using a hash symbol (#) but not for comment

Posted: Fri Aug 30, 2024 4:57 pm
by richmond62
Presumably a hash sign that is enclosed in double quotes will be treated as a string.

Re: Using a hash symbol (#) but not for comment

Posted: Sat Aug 31, 2024 11:16 am
by kaveh1000
Thanks Richmond. It's a complex regex pattern and quotes makes it more complex. So I used an unusual character (●) then replaced it just before using...

Re: Using a hash symbol (#) but not for comment

Posted: Sat Aug 31, 2024 11:40 am
by richmond62
Read Treasure Island: you'll never use a black spot again. 8)

Re: Using a hash symbol (#) but not for comment

Posted: Sat Aug 31, 2024 11:41 am
by kaveh1000
Not going there. Will not give up my black spot. ;-)