travisbrown
Technical User
- Dec 31, 2001
- 1,016
I'm sure this issue's come up here before, but can't find a reference.
I need to find a way to encode ampersands that are not already part of named or numeric entities.
For example,
I need to replace the & in R&B resulting in R&B but not double encode an existing entity.
Is there some snappy way I can do this with REGEX? Maybe replace any amp that is not followed by a semicolon three or four characters later? Seems less than perfect. Before I go chasing some unwieldy solution, any suggestions?
I need to find a way to encode ampersands that are not already part of named or numeric entities.
For example,
I need to replace the & in R&B resulting in R&B but not double encode an existing entity.
Is there some snappy way I can do this with REGEX? Maybe replace any amp that is not followed by a semicolon three or four characters later? Seems less than perfect. Before I go chasing some unwieldy solution, any suggestions?