Regular Expressions

Regular Expressions

am 29.01.2008 12:39:49 von UKuser

Hi Guys,

I am currently working on the following to completely replace the href> tag and all content but its not working:

$input = "Text
here
";
echo ereg_replace('',"", $input);

Will keep working on it but if you get there first any help would be
great.

Thanks

A

Re: Regular Expressions

am 29.01.2008 12:46:41 von UKuser

On Jan 29, 11:39 am, UKuser wrote:
> Hi Guys,
>
> I am currently working on the following to completely replace the > href> tag and all content but its not working:
>
> $input = "
Text
> here
";
> echo ereg_replace('',"", $input);
>
> Will keep working on it but if you get there first any help would be
> great.
>
> Thanks
>
> A

Done it - solution is

Re: Regular Expressions

am 29.01.2008 12:46:54 von Erwin Moller

UKuser wrote:
> Hi Guys,
>
> I am currently working on the following to completely replace the > href> tag and all content but its not working:
>
> $input = "
Text
> here
";
> echo ereg_replace('',"", $input);

At first glance:
[A-Za-z0-9._-] is a characterclass, but you forgot the + after it, so it
matches 1 or more times.

Secondly: [&\?=]+ will not match
test.html?name=joe&age=11

Wouldn't it be easier to simply try to match:
1) begins with:
Text
>> here
";
>> echo ereg_replace('',"", $input);
>>
>> Will keep working on it but if you get there first any help would be
>> great.
>>
>> Thanks
>>
>> A
>
> Done it - solution is


Hi,

That misses:
< a href=
or

I am not sure if that is a problem.

Regards,
Erwin Moller

Re: Regular Expressions

am 29.01.2008 12:58:50 von Courtney

Erwin Moller wrote:
> UKuser wrote:
>> On Jan 29, 11:39 am, UKuser wrote:
>>> Hi Guys,
>>>
>>> I am currently working on the following to completely replace the >>> href> tag and all content but its not working:
>>>
>>> $input = "
Text
>>> here
";
>>> echo ereg_replace('',"", $input);
>>>
>>> Will keep working on it but if you get there first any help would be
>>> great.
>>>
>>> Thanks
>>>
>>> A
>>
>> Done it - solution is

>
> Hi,
>
> That misses:
> < a href=
> or
>
>
> I am not sure if that is a problem.
>
> Regards,
> Erwin Moller

Yeah, it was about that sort of time when I first encountered regexps,
that I gave up and decided that I would settle down and write a state
machine in 'C' and consider every possible combination of words/letters,
and write a custom routine.


Never touched em since. Spawn of the devil.