View previous topic :: View next topic |
Author |
Message |
mbirkett n00b
Joined: 03 Sep 2002 Posts: 45 Location: Newcastle Upon Tyne
|
Posted: Tue Jan 07, 2003 1:45 pm Post subject: Regular Expressions & PERL |
|
|
Hi i am attepting to remove '+' signs from a form posted via a cgi script to another one.
To do this i propose to use:
$subst = /\+\+s/;
to identify and replace '+' with a whitespace character. Will this work, and how to i pass the posted outut through this comparitor?
Any help appreciated,
Cheers,
marc _________________ I am Thybrush Greepwood, a mighty privet... |
|
Back to top |
|
|
cram Guru
Joined: 17 Nov 2002 Posts: 312 Location: Saskatoon, Canada
|
Posted: Tue Jan 07, 2003 2:02 pm Post subject: |
|
|
A perl regex to replace '+' characters with spaces is Code: | $string_with_plusses =~ s/+/ /; |
Quote: | and how to i pass the posted outut through this comparitor |
not sure what you mean by this _________________ aaarggghhhh.
Good point Chewie. |
|
Back to top |
|
|
mbirkett n00b
Joined: 03 Sep 2002 Posts: 45 Location: Newcastle Upon Tyne
|
Posted: Tue Jan 07, 2003 2:06 pm Post subject: |
|
|
i want to get the values passed from the first script, in the second, then run the comparison to remove '+' signs and display it on the webspage.
Cheers,
amrc _________________ I am Thybrush Greepwood, a mighty privet... |
|
Back to top |
|
|
doug-x07 Tux's lil' helper
Joined: 16 Nov 2002 Posts: 122 Location: Paris, France
|
Posted: Tue Jan 07, 2003 2:35 pm Post subject: |
|
|
Try:
Code: | $string =~ s/\+//g; | If you don't despecialise the plus sign it will not parse. You need the g to catch lines with multiple plus signs otherwise the regexp will just strip the first one.
If I understand your last question correctly on passing the value to another script, just pass it as a parameter to the second script and recover it from @ARGV. _________________ #! /usr/bin/perl
if( @first != $succeed ) {
post { $question->forum && eval '$answers' };
try { $again } catch { $problem && $resolve };
bless $posters; } |
|
Back to top |
|
|
mbirkett n00b
Joined: 03 Sep 2002 Posts: 45 Location: Newcastle Upon Tyne
|
Posted: Tue Jan 07, 2003 2:41 pm Post subject: |
|
|
Ill give it a try.
Cheers,
Marc _________________ I am Thybrush Greepwood, a mighty privet... |
|
Back to top |
|
|
|