The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)

20131008

regex regexp regular expressions - how to find all xml/xsl border-width attributes not value "0.00mm"

say i have hundreds of similar xsl code blocks like the one below:

<fo:block-container border-color="#ff0000"
    border-style="solid" border-width="0.10mm" background-color="transparent"
    left="90.05mm" top="50.05mm" height="7.90mm" width="19.90mm"
    margin-left="0.00mm" margin-top="0.00mm" margin-right="0.00mm"
    margin-bottom="0.00mm" position="absolute">
    <fo:block text-align="start" space-after.optimum="0pt"
        line-height="8pt" font-family="Helvetica" color="#000000"
        font-size="6pt" font-style="normal" font-weight="normal">
        22 Stedsnr.
    </fo:block>
</fo:block-container>





if you want to find all code blocks with attributes that don't contain a border-width attribute with the value "0.00mm", then use the following regular expression:

border-width="(?!0\.00)[0-9\.]+mm"

explanation:
(?!0\.00) means don't match the string 0.00

but match any length of a combination of numbers and periods, [0-9\.]+, preceding the string "mm"


No comments:

Post a Comment