Welcome to WebmasterWorld Guest from 54.167.29.212

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Form Regex

form regex to exclude "/" text character

     

colintho

1:52 pm on May 27, 2005 (gmt 0)

10+ Year Member



Not sure if this is the right place for this post?

How do I use "form regex" to exclude a text character, forward slash "/" from text entered into a database field?

lexipixel

5:18 pm on May 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



More likely what you want to do is substitute the '/' character using a $var =~ s///; construct after parsing the form data.

EXAMPLE #1:

#
$datastring = 'this has a / in it';
$datastring =~ s/\// /g;
#
print $datastring;
#

SHOULD PRODUCE OUTPUT: this has a in it

~~~ OR ~~~~

EXAMPLE #2:

#
$datastring = 'this has a / in it';
$datastring =~ s/\//_/g;
#
print $datastring;
#

SHOULD PRODUCE OUTPUT: this has a _ in it

 

Featured Threads

Hot Threads This Week

Hot Threads This Month