regex - Regular expression to parse html links -
I have html with this type of snippet:
& lt; Li & gt; ; & Lt; Label = "Summary" for & gt; Summary: & lt; / Labels & gt; & Lt; / Li & gt; & Lt; Li class = "in" & gt; & Lt; Textarea class = "ta" id = "summary" name = "summary" rows = "4" cols = "10" tabindex = "4" & gt; $ {FieldValue (Bean: Book, Field: 'Summary')} & lt; / Textarea & gt; & Lt; A href = "#" square = "TT"> & Lt; Img src = "& lt; g: createLinkTo dir = 'image / button /' file = 'icon.gif' / & gt; Alt = "Help icon for summary field" & gt; & Lt; Span class = "tooltip" & gt; & Lt; Span class = "top" & gt; & Lt; / Span & gt; & Lt; Span class = "middle" & gt; Help Lessons for Summary & lt; / Span & gt; & Lt; Span class = "bottom" & gt; & Lt; / Span & gt; & Lt; / Span & gt; & Lt; / A & gt; & Lt; / Li & gt;
I want to draw the text between alt value and XXXX and change the tag with the code below.
reg reg
& lt; A href = "#" class = "tt" & gt; * Alt = "(. *)". * & Lt; Span class = "middle" & gt; (. *) & LT; \ / Span & gt; & Lt; \ / A & gt; Output with callback & lt; Ebs: cssToolTip alt = "$ 1" text = "$ 2" />
I tried it out and it does not work much. Any Suggestion
You can make sure that your regexp is not greedy - use the word Instead of ". *" Instead of ". *"
Comments
Post a Comment