Please can someone help me with this before I explode!!! (no pun intended)
<?php
// EXAMPLE 1
$text = "This is Driving me mad";
$check = "Driving";
$ss = "([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z ˝\',\.]{0,30}[ ])";
preg_match($ss,$text,$check);
echo "result = $check[0]"; //gives a result
echo "<br>";
// EXAMPLE 2
$text = "This is Driving me mad";
$check = "driving"; // NOTE CHANGE Driving to driving
$ss = "([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z ˝\',\.]{0,30}[ ])";
preg_match($ss,$text,$check);
echo "result = $check[0]"; // gives nothing.
?>
According to php.net /i is required to make it case sensitive, so why is
this happening?!?!
Nel.
--
DISCLAIMER: There is an extremely small but nonzero chance that,
through a process known as "Tunneling", this e-mail may spontaneously
disappear from its present location and reappear at any random place in the
Universe, including your neighbour's domicile. The sender will not be
responsible for any damages or inconvenience that may result. 4 2529
Nel wrote: Please can someone help me with this before I explode!!! (no pun intended)
$check = "Driving"; $ss = "([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z ˝\',\.]{0,30}[ ])"; preg_match($ss,$text,$check);
$check = "driving"; // NOTE CHANGE Driving to driving $ss = "([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z ˝\',\.]{0,30}[ ])"; preg_match($ss,$text,$check);
According to php.net /i is required to make it case sensitive, so why is this happening?!?!
Becuase you don't have it there???
$ss = "`([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z ˝\',\.]{0,30}[
])`i";
--
Justin Koivisto - sp**@koivi.com http://www.koivi.com
"Justin Koivisto" <sp**@koivi.com> wrote in message
news:Hj*****************@news7.onvoy.net... Nel wrote:
Please can someone help me with this before I explode!!! (no pun
intended) $check = "Driving"; $ss = "([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z
˝\',\.]{0,30}[ ])"; preg_match($ss,$text,$check);
$check = "driving"; // NOTE CHANGE Driving to driving $ss = "([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z
˝\',\.]{0,30}[ ])"; preg_match($ss,$text,$check);
According to php.net /i is required to make it case sensitive, so why is this happening?!?!
Becuase you don't have it there???
$ss = "`([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z ˝\',\.]{0,30}[ ])`i";
-- Justin Koivisto - sp**@koivi.com http://www.koivi.com
Thanks Justin.
All the documentation says to use /i at the end of the string. http://php.us.themoes.org/manual/en/...preg-match.php
I have spent ages trying to fit /i somewhere, anywhere to make it work.
You may well have saved my sanity :-)
Nel.
Nel wrote: "Justin Koivisto" <sp**@koivi.com> wrote in message news:Hj*****************@news7.onvoy.net...
Nel wrote:
Please can someone help me with this before I explode!!! (no pun intended) $check = "Driving"; $ss = "([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z ˝\',\.]{0,30}[ ])"; preg_match($ss,$text,$check);
$check = "driving"; // NOTE CHANGE Driving to driving $ss = "([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z ˝\',\.]{0,30}[ ])"; preg_match($ss,$text,$check);
According to php.net /i is required to make it case sensitive, so why is this happening?!?!
Becuase you don't have it there???
$ss = "`([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z ˝\',\.]{0,30}[ ])`i";
Thanks Justin.
All the documentation says to use /i at the end of the string. http://php.us.themoes.org/manual/en/...preg-match.php
I have spent ages trying to fit /i somewhere, anywhere to make it work.
It's onlt /i if you use the "/" as the regex delimiter. In my reply, I
used the backtick "`" instead (I do that so I don't have to escape all
my "/" characters.
Here's a little more reading (just search for perl regex or perl regular
expressions to find a whole lot more!): http://www.anaesthetist.com/mnm/perl/regex.htm http://www.comp.leeds.ac.uk/Perl/matching.html
And the ones I'm sure you've found already: http://us2.php.net/manual/en/referen...ern.syntax.php http://us2.php.net/manual/en/ref.pcre.php
--
Justin Koivisto - sp**@koivi.com http://www.koivi.com
"Justin Koivisto" <sp**@koivi.com> wrote in message
news:pX*****************@news7.onvoy.net... Nel wrote:
"Justin Koivisto" <sp**@koivi.com> wrote in message news:Hj*****************@news7.onvoy.net...
Nel wrote:
Please can someone help me with this before I explode!!! (no pun
intended)
$check = "Driving"; $ss = "([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z
˝\',\.]{0,30}[ ])";
preg_match($ss,$text,$check);
$check = "driving"; // NOTE CHANGE Driving to driving $ss = "([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z
˝\',\.]{0,30}[ ])";
preg_match($ss,$text,$check);
According to php.net /i is required to make it case sensitive, so why
isthis happening?!?!
Becuase you don't have it there???
$ss = "`([ ][0-9a-zA-Z ˝\',\.]{0,30}".$check."[0-9a-zA-Z ˝\',\.]{0,30}[ ])`i";
Thanks Justin.
All the documentation says to use /i at the end of the string. http://php.us.themoes.org/manual/en/...preg-match.php
I have spent ages trying to fit /i somewhere, anywhere to make it work.
It's onlt /i if you use the "/" as the regex delimiter. In my reply, I used the backtick "`" instead (I do that so I don't have to escape all my "/" characters.
Here's a little more reading (just search for perl regex or perl regular expressions to find a whole lot more!):
http://www.anaesthetist.com/mnm/perl/regex.htm http://www.comp.leeds.ac.uk/Perl/matching.html
And the ones I'm sure you've found already: http://us2.php.net/manual/en/referen...ern.syntax.php http://us2.php.net/manual/en/ref.pcre.php
-- Justin Koivisto - sp**@koivi.com http://www.koivi.com
Many thanks Justin :-)) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: fartsniff |
last post by:
hello all,
here is a preg_match routine that i am using. basically, $image is set in
some
code above, and it can be either st-1.gif or sb-1.gif (actually it randomly
picks
them from about 100...
|
by: Han |
last post by:
I'm wondering if someone can explain why the following works with
preg_match_all, but not preg_match:
$html = "product=3456789&"
preg_match_all ("|product=(\d{5,10})&|i", $html, $out);
$out...
|
by: awebguynow |
last post by:
I ran across this code, and it kind of made me nervous: (as an email
validator)
if ( !preg_match("/.*\@.*\..*/", $_POST) | preg_match("/(\)/",
$_POST) )
1) from bitwise experience with "C",...
|
by: squash |
last post by:
I have a string equal to 'www/' that I want to use in a preg_match. Php
keeps giving me the warning:
Warning: preg_match(): Unknown modifier '/'
How can I escape the string so the / in www/ is...
|
by: Mark Woodward |
last post by:
Hi all,
I'm trying to validate text in a HTML input field.
How do I *allow* a single quote?
// catch any nasty characters (eg !@#$%^&*()/\)
$match = '/^+$/';
$valid_srch = preg_match($match,...
| |
by: mantrid |
last post by:
Hello
Found this piece of code using preg_match to check file types during upload
of files.
$allowed_file_types = "(jpg|jpeg|gif|bmp|png)";
preg_match("/\." . $allowed_file_types . "$/i",...
|
by: JanDoggen |
last post by:
function vldLicense($lic)
{
echo "called with lic: ". $lic . "<br>";
echo preg_match('', $lic) . "<br>";
if (preg_match('{4}-{4}-{4}-{4}', $lic) == 0) return false;
return true;
}
gives me:
|
by: chadsspameateremail |
last post by:
I might have found a problem with how preg_match works though I'm not
sure.
Lets say you have a regular expression that you want to match a string
of numbers. You might write the code like this:...
|
by: Happy Face |
last post by:
Hi, All,
I encountered this strange problem while using function preg_match.
The following is the php code.
when I set the line:
$text = str_repeat('*', 12500);
preg_match will return 0 for...
|
by: Thomas Mlynarczyk |
last post by:
Hello,
I want to split a given string into tokens which are defined by regexes:
// example tokens - a bit more complex in real
$tokens = array(
'NUMBER' ='~^\d+~',
'NAME' ='~^+~',
'ANY' ...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |