Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Substituting with match containing newline and space characters

by choroba (Cardinal)
on Mar 30, 2015 at 13:12 UTC ( [id://1121827]=note: print w/replies, xml ) Need Help??


in reply to Substituting with match containing newline and space characters

You aren't trying to parse HTML with regular expressions, are you?

Use a proper HTML handling module. For example, XML::XSH2, a wrapper around XML::LibXML:

open :F html file.html ; for //input[@type="checkbox"] { $attr = @*[xsh:matches(.,'\[0\]$')] ; $name = xsh:match($attr, '.*\.(.*)\[0\]$') ; if $name set @label $name ; } save :F html :b ;
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re: Substituting with match containing newline and space characters
  • Download Code

Replies are listed 'Best First'.
Re^2: Substituting with match containing newline and space characters
by MorayJ (Beadle) on Mar 30, 2015 at 13:43 UTC
    Unfortunately, yes...I just wanted to be quick and dirty and all I've achieved so far is dirty. Thanks for the example...may have to turn this ship around.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1121827]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-25 20:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found