in reply to XML / regex - cleaning up attributes
If it was just single quotes, one could come up with a generic solution that works well in most circumstances.
s/(?<!=)'(?![ >])/'/g
However, & is allowed in Windows file names, and that's much trickier to handle generally. Since only one field is likely to hold incorrect data, this problem can be handled easily.
use HTML::Entities qw( encode_entities_numeric ); s/(?<=<app text=')(.*?)(?=' date)/encode_entities_numeric("$1")/eg;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML / regex - cleaning up attributes
by ethrbunny (Monk) on Oct 01, 2010 at 16:43 UTC |