Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to match special characters

Status
Not open for further replies.

thendal

Programmer
Aug 23, 2000
284
Hey guys!

I have a problem,Iam storing a set of data in a flat file
where iam searching a particular field which carries special characters in it.
Flat file looks like

FIELD1|SEARCHABLE Field|filed3
name|Name(area)|notes
name1|name-city(code)|notes1
name2|Name2-city2|notes 2

When user selects the drop down city and searchs the flat file.

It will match the data's with '-' not '('

what may be the cause.Explain please any function to escape the special characters

For matching

Iam using the code
if($userselect=~/$searchable_field_from_Flatfile/)
{
}

advise me guys...






 
try:

$searchable_field_from_Flatfile =
quotemeta($searchable_field_from_Flatfile);

before you use it in the regex.

hth
 
Phil!

I used your quotemeta method but it seem to be adding a '/'
infront the special characters and its not matching.
what i have to do here any help.

Thendal
 
Is there is any way to match variable ignoring the special character in it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top