![]() |
|
Keep It Simple, Stupid | |
PerlMonks |
Output minimal occurrences of matching regex(es)by LexPl (Sexton) |
on Nov 13, 2024 at 16:41 UTC ( [id://11162683]=perlquestion: print w/replies, xml ) | Need Help?? |
LexPl has asked for the wisdom of the Perl Monks concerning the following question: I have got XML entities which sometimes follow directly after each other. In some cases, they are separated by a space, in other cases they aren't. Which of these alternatives will be correct, depends on the two entities involved. You might find "... § 9 ...", but also "... – Übertragung ..." The following script lists the matching regexes that were found in the input file. Ideally, I would get the occurrences of the entities matching a generic regex such as ;\s&. So for example §  or öß so that I might detect the existing combinations of entities. That's what I mean by "minimal occurrences". I would also like to handle original files in a different manner than modified ones: In original files, I'm looking for spaces between two entities, i.e. regex: ;\s&/, to verify, how many occurrences are in the original file so that I may check the modified files whether any of these spaces have been lost. Here it would nice to see which combinations exist in a given file. In modified files, I use regexes to find issues of missing space that I have already recognized. To switch between these two control flows, I have tried an expression for different my @regexes, but that didn't work. Here's my script I'm referring to:
Back to
Seekers of Perl Wisdom
|
|