[FX.php List] PHP question
Gareth Evans
gareth.evans at schawk.com
Thu Jan 14 07:40:30 MST 2010
What I sent will match any string ending in hall¹ (case-insensitive). Leo
is right that you should add a space to make it just hall¹ and if you want
it to be case-sensitive remove the i.
This is the revised one:
preg_match('/ Hall$/¹, $_POST['Department_Name'])
It will match any string ending in ³ Hall².
--
GARETH EVANS
> From: "VanBuskirk, Patricia" <pvanbuskirk at otc.fsu.edu>
> Reply-To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> Date: Thu, 14 Jan 2010 09:29:48 -0500
> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
> Subject: RE: [FX.php List] PHP question
>
> Thanks guys! Can it look for a space in front of it as well, so I
> wouldn't get anything that just contained the letters "hall" ... in
> other words, just find the WORD "Hall"?
>
>
>
> From: fx.php_list-bounces at mail.iviking.org
> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Leo R.
> Lundgren
> Sent: Thursday, January 14, 2010 9:27 AM
> To: FX.php Discussion List
> Subject: Re: [FX.php List] PHP question
>
>
>
> Add a space to the regex :)
>
>
>
> Also not that this checks for "hall" as well as "Hall" in the end.
>
>
>
>
>
> 14 jan 2010 kl. 15.22 skrev Gareth Evans:
>
>
>
>
>
> A preg_match will work.
>
> if (isset($_POST['Department_Name']) && preg_match('/hall$/i',
> $_POST['Department_Name']) {
> --
> GARETH EVANS
>
>
>> From: "VanBuskirk, Patricia" <pvanbuskirk at otc.fsu.edu>
>> Reply-To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
>> Date: Thu, 14 Jan 2010 09:19:24 -0500
>> To: "FX.php Discussion List" <fx.php_list at mail.iviking.org>
>> Subject: [FX.php List] PHP question
>>
>> This is probably an easy one, but I cannot think this morning! In
> PHP,
>> if I wanted to see if the contents of a field end with something, how
>> would I word it?
>>
>>
>>
>> Ie. If the Department Name ends in " Hall" (Landis Hall, Bryan Hall,
>> etc), then do this...
>>
>>
>>
>> Here's what I'm trying and it is not working:
>>
>>
>>
>> if (isset($_POST['Department_Name']) && $_POST['Department_Name'] ==
> "*
>> HALL") {
>>
>>
>>
>> Thanks,
>>
>> Trish
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
>
>
>
> -|
>
>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20100114/be76b809/attachment.html
More information about the FX.php_List
mailing list