I need to capture all lines that start C: and end in <br />
i am struggling to match the end <br />
i wish to do preg_match_all can any one help?
I need to capture all lines that start C: and end in <br />
i am struggling to match the end <br />
i wish to do preg_match_all can any one help?
Can you give us an example of a string you want to match and not match?
~^C:.*<br/>~
cheers dude
the line would look like
C: server port username password
C: myserver.no-ip.org 12000 admin admin
they are an example
Are you talking break tags or newlnes/carriage returns or all?
You surely want .*? instead…
id like it so that it would just literally match any line that looked like
C: myserver.no-ip.org 12000 admin admin
and it ignore after the last bit with the <br>
I found a solution i think now ill post the solution later for any one else looking for something similar
I think you’re getting confused between <br /> tags and newlines (
).
Something like ^C:.*?$
should do the trick.
I’m not familiar enough with PHP syntax to write something off the top of my head, but in Ruby it would be:
str = "
C: myserver.no-ip.org 12000 admin admin
Some other stuff
C: myserver.no-ip.org 12000 admin admin
"
p str.scan(/^C:.*?$/)
=> ["C: myserver.no-ip.org 12000 admin admin", "C: myserver.no-ip.org 12000 admin admin"]
HTH
many thanks i will give this a go
thank you everyone for your help!