Regular expression matches but can't replace
Posted: Thu Mar 19, 2009 3:51 pm
hi,
I'm using oXygen 9.3 and have a problem with the following regular expression
short explanation:
I'm searching for XML-tags followd by optional space or tab followed by required line-break in any form followd by optional space or tab followed by a XML-tag.
The last XML-Tag is found by a lookahead-expression (?=...)
Try the regexp-search with the following code-snippet:
A "normal" search matches 13 times.
Everything's great!
But if I want to replace all the line-breaks, tabs and spaces with- the first XML-tag (to create a "one-line-XML" (don't ask why ))
I get the error:
thanks!
-- toby
I'm using oXygen 9.3 and have a problem with the following regular expression
Code: Select all
(</[^<]+?>|<[^/<]+?>|<[^/][^<]+?\/>)([ \t]*)(\n|\r|(\r\n))+([ \t]*)(?=</[^<]+?>|<[^/<]+?>|<[^/][^<]+?\/>)
I'm searching for XML-tags followd by optional space or tab followed by required line-break in any form followd by optional space or tab followed by a XML-tag.
The last XML-Tag is found by a lookahead-expression (?=...)
Try the regexp-search with the following code-snippet:
Code: Select all
<st:seite nr="2">
<st:einschub typ="2">
<st:abs ausricht="zentriert">Stefan Zweig<ty:zw/></st:abs>
<st:abs ausricht="zentriert"><ty:abstand wert="3lz"/>Gesammelte Werke<st:br/><ty:zw/> in
Einzelbänden<ty:zw/></st:abs>
<st:abs ausricht="zentriert"><ty:abstand wert="29lz"/>S. Fischer Verlag<ty:zw/></st:abs>
</st:einschub>
</st:seite>
<st:seite nr="3">
<st:einschub typ="2">
<st:abs ausricht="zentriert">Stefan Zweig<ty:zw/></st:abs>
<st:abs ausricht="zentriert"><ty:abstand wert="3lz"/>Maria Stuart<ty:zw/></st:abs>
<st:abs ausricht="zentriert"><ty:abstand wert="29lz"/>S. Fischer Verlag<ty:zw/></st:abs>
</st:einschub>
</st:seite>
Everything's great!
But if I want to replace all the line-breaks, tabs and spaces with
Code: Select all
$1
I get the error:
Can someone help me?wrong syntax:
match not possible
thanks!
-- toby