Re: Trying to remove text in inverted commas.
am 24.08.2009 19:50:02 von rvtol+usenetGregory Machin wrote:
> I'm writing a script to import logs into a Mysql .. My Perl is rusty
> and I'm battling with a convention on the one column. I need to
> remove the text in inverted commas "Prashil" 106 so that just the
> number 106 remains.. I have been trying the following regex
> s/(\"([^"]+)\"\s)//g but it doesn't seem to work. I got it from a
> website .. It looked correct .. mmm .. with regard to it's structure i
> don't quite get ([^"]+) as I have tried replacing it with other
> combinations and had less luck. I have also tried
> s/\"([:word:])\"\s)//g ...
Your substitution code (not: regex) looks OK, so something else is wrong.
The substitution code can be simplified to: s/"[^"]*"\s*//g
Maybe your data is encoded in some way?
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/