[PHP] Re: regex help

2002-09-05 Thread Richard Lynch
> >$str = 'hi my friend! this message uses html entities href="http://www.trini0.org";>test!'; >$str = preg_replace('/(.*<\/a>)/', >htmlspecialchars("$1"), $str); Maybe I'm missing something here, but can't you just do: $str = htmlspecialchars($str); -- Like Music? http://l-i-e.com/artists.

[PHP] Re: REGEX for credit card number

2002-07-29 Thread Manuel Lemos
Hello, On 07/28/2002 05:02 PM, Mike Mannakee wrote: > Does anyone have a regular expression that works to validate credit card > numbers? No, there is not regular expression for that. You may want to use this class instead for validation credit card numbers in forms: http://www.phpclasses.org/

Re: [PHP] Re: REGEX for phone #

2002-07-29 Thread Analysis & Solutions
Hi Richard: On Mon, Jul 29, 2002 at 05:02:49AM -0500, Richard Lynch wrote: > > For starters, if Perl wants \ PHP needs \\ since \ is special in both > languages. I'm curiuos what you're talking about. The manual says nothing about this in the PCRE section: Example 1. Examples of valid patte

[PHP] Re: REGEX for credit card number

2002-07-29 Thread Richard Lynch
>Does anyone have a regular expression that works to validate credit card >numbers? http://php.net/links.php has links to code archives that will give you tons of them. Ditto for the phone numbers post I'm about to read. NOTE: Making users not be able to use phone numbers like 1-800-MY-STUFF

[PHP] Re: REGEX for phone #

2002-07-29 Thread Richard Lynch
>I'm using a regular expression (below) to check phone numbers. I'm getting >an error that I can't make sense of. > >$regex = "^((\(\d{3}(\) -))?*\d{3}(- )\d{4},?*)+$"; > >Output I'm getting = >Warning: REG_BADRPT in /home/basemen/public_html/verify_order.php on line 28 > >Anyone know what this m

[PHP] Re: regex for emoticon codes

2002-07-09 Thread Richard Lynch
>i have something like >$str = "sometext sometext [emoticon01] sometext [emoticon23] sometext"; > >i would like to use regex to replace those codes into: >sometext sometext /images/emot/01.gif sometext /images/emot/23.gif sometext > >all numerics after the code "emoticon" consisted of exactly 2 d

[PHP] Re: RegEx question

2002-07-03 Thread Tracker 1
"Richard Lynch" <[EMAIL PROTECTED]> wrote in message... > > How can I regex to compare the last three chars of a string to "php"? > > if (substr($foo, -3) == 'php'){ > } > > Oh, wait, you wanted to use RegEx. Sorry, can't help you there. :-) > > Don't use a cannon to swat a fly. probably a good

[PHP] Re: RegEx question

2002-07-03 Thread Tracker 1
as a preg "/(...)$/" this gives you the last three chars.. -- === Michael J. Ryan - tracker1[*at*]theroughnecks.com Roughneck BBS: http://www.theroughnecks.net telnet://theroughnecks.net =

[PHP] Re: RegEx question

2002-07-02 Thread Richard Lynch
> How can I regex to compare the last three chars of a string to "php"? if (substr($foo, -3) == 'php'){ } Oh, wait, you wanted to use RegEx. Sorry, can't help you there. :-) Don't use a cannon to swat a fly. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://

[PHP] Re: RegEx and ?

2002-04-24 Thread liljim
What d'ya know. I should read the manual more regularly. http://www.php.net/manual/en/function.preg-quote.php ~J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: RegEx and ?

2002-04-24 Thread liljim
Hi Berber, you generally need to do some string replacements on the text you're using to put through the match before you actually do the match (and same for replacements). Just have a look at the pattern syntax in the manual for the characters you need to do the replacement on... e.g $string =

[PHP] Re: Regex Form Filter Help

2002-03-28 Thread liljim
Hello James, "James Taylor" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a site where users can type whatever they want in and it posts it to a > database. I'm trying to eliminate whatever types of abuse I can think of, > and, since I'm using nl2br o

[PHP] Re: regex

2002-02-27 Thread CC Zona
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Paul A. Procacci) wrote: > ticket_id=3&change_name=status&change_value=3&ticket_id=3&2=&1=& > > And all I want is 2=&1=&. Well, the closest I came was : > > $string = preg_replace("/[^0-9]+\=/", "", $QUERY_STRING); Assuming > QUERY_STRING w

[PHP] Re: Regex problem

2001-10-25 Thread Calin Uioreanu
$sNoSpaces = ltrim($variable); if ('*' == $sNoSpaces[0]) -- Regards, -- Calin Uioreanu [EMAIL PROTECTED] Tel: +49 - (0) 89 - 25 55 17 23 http://www.ciao.com -- "Leon Mergen" <[EMAIL PROTECTED]> wrote in

[PHP] Re: Regex problem

2001-10-25 Thread liljim
Hello Leon, try this if (preg_match("/^([[:space:]]*)?\*/s", $string)) { echo "Match."; } else { echo "No match"; } James "Leon Mergen" <[EMAIL PROTECTED]> wrote in message 002f01c15d2a$e4ca3030$012aa8c0@leon">news:002f01c15d2a$e4ca3030$012aa8c0@leon... Hi there, I am camping with a little

[PHP] Re: Regex help

2001-08-22 Thread Robin Vickery
[EMAIL PROTECTED] (Stefen Lars) writes: > In the Apache config file, we have the following directive: > > SetEnvIfNoCase Referer "^http://www.oursite.com/"; local_ref=1 > > > Order Allow,Deny > Allow from env=local_ref > > > We use this to prevent people from directly linking to .gif and

[PHP] Re: Regex question

2001-07-31 Thread Andrew Sterling Hanenkamp
You're making your expressions too complicated. To test for just that string, eregi("HTTP/1\.[01] 302", $output) should work. Later, Sterling Boaz Yahav wrote: > I'm trying to find if a string exists inside a string. Instead of using > strstr() twice I want to use eregi() once. > > What I w

[PHP] Re: regex for cleaning up username

2001-07-23 Thread maatt
> thinking it may be easier to parse for only allowed characters. *much* better idea. Try: preg_match('/[^\w]/', $string) to find all non-alphanumeric+underscore -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMA

[PHP] Re: regex for cleaning up username

2001-07-22 Thread CC Zona
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Dave) wrote: > Cannot seem to get a regex to check a string for the following > > space tab ' " ! @ # $ % ^ & * ( ) + = : ; / \ > > if(preg_match('[\'" ,!@#$%\^&*()+=:;/\\]',$mystring)) You need pattern delimiters with preg_* expression

[PHP] Re: regex question

2001-07-16 Thread Philip Hallstrom
You could do it using the strpos() function to find the index of the first occurance of "" and strrpos() for the last occurence. Then use substr() to grab what you want... On Mon, 16 Jul 2001, Julian Simpson wrote: > I'm trying to parse an existing html file using php. > I need to use regex to

<    1   2