Hello:
Been following the discussions for some time. The help has been
invaluable, but I have a regexp that I am having trouble with.
I am working on a search engine for my sites FAQs. The user can enter
any text they choose. The subroutine replaces all char that are not
A-Za-z0-9 " \s with a blank space. Does fine and it cleans all spaces
up so I can split it up into an array of words to look for in the titles
of the FAQs.
What I am doing is if a person enters a dimension I need to leave the
trailing " , if not after a digit I have to eliminate it. The following
is part og the code I have tried including the look behind aspect of
(?<!\d) gives me a not readable error (?...).
Thank you for the help.
Jos�
sub clean_up_query{ #subroutine like this works
my $lookie_here = shift;
my $okay_char = "[^A-Za-z0-9\"\\s]";
my $okay_numbers = "0-9";
# Blast out all chars except quote char and white space
$lookie_here =~ s/$okay_char/ /g;
# lets try to blast away dbl quotes
$lookie_here =~ s/\d\"/[\d]/g; #Here is PROBLEM
#$lookie_here =~ s/\"(?<!\d)/ /g; #tried this too
# clean up query for spaces
$lookie_here =~ s/^\s+//; #discard leading white space
$lookie_here =~ s/\s+$//; #discard trailing white space
$lookie_here =~ s/\s+/ /g; #collapse internal white space
chomp($lookie_here); #eliminate end white space
#break string up into array
my @look_for_string = split( / / , $lookie_here);
return @look_for_string; #return call is okay
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]