Forum Moderators: coopster
You can use the strstr [uk2.php.net] function if you want to check for an instance of something in a string.
$string = 'Boo^';
To check for the caret above you would do:
if (strstr($string,'^'))
{
return true;
}
else
{
return false;
}
strstr returns true if the specified char is found and false if not.
Or isn`t that what you meant?
dc
if ($string ~= /^/) {
preg_match and friends are what you are looking for, see e.g. [php.net...]
Note that PHP's regexes are similar to, but not quite like Perl's, which can sometimes cause confusion.
Personally I find Perl much less tiresome to work with when it comes to regular expressions
Never could get this to work, so reformatted my text as tab delimited and split on the /\t/ and newline /\n/. Couldn't get it to work earlier but from what you helped me with I can now!
Still couldn't figure out how to tell if a string has a ^ or a ~ in it, but it doesn't matter anymore.
Thanks for all the help.
Rob