Regex: match double OR single quote
- From: Jason C <jwcarlton@xxxxxxxxx>
- Date: Thu, 12 Jul 2012 15:12:33 -0700 (PDT)
I'm struggling with what I thought was a simple thing, and I'm hoping you guys can help.
I have a string that may contain a ", ', or neither. So, I wrote this in the regex:
But this doesn't match anything.
Here's the complete code:
# $text comes from a form, so this is just a sample
$text = <<EOF;
<img src="<a href='http://www.example.com/whatever.jpg'
width="300" height="300" border="0">
# Regex; line breaks added here for the sake of reading
$text =~ s/<img(.*?)src=
If I change ["|']* to whatever I have hard coded, then it works fine, so I know the issue is with that pattern. So how do I correctly match them?
- Prev by Date: Re: Traversing folders
- Next by Date: Re: Regex: match double OR single quote
- Previous by thread: LibXML element->toString vs document->toString
- Next by thread: Re: Regex: match double OR single quote