Regex negative look behind???

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

feyd wrote:I feel a string parser would fair a lot easier and faster (performance) to do this task.
I can't say i'm familiar with what a string parser is??? :?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Maybe i'll just use the PHP tokenizer
A very good idea. ;)
I can't say i'm familiar with what a string parser is???
You build it totally out of PHP. A search string parsing example can be found here (along with a competing, regexp solution) as well as another example built for parsing HTML.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Ambush Commander wrote:Would you like me to write one?
Indeed :)

But what you mean string parser?

Your going to write an EBNF grammar and parsing framework in PHP???

Or a more trivial PHP class which knows only the rules which I stipulate earlier???

Is that what Feyd meant? That was kinda the route I was hoping to avoid, because locating statements is JUST one task of many which I wanted to perform on the source code... :?

It would be easier to just use the tokenizer functions...which I think i'm going to do anyways...originally I didn't want to...cuz the version of PHP I have installed on my local machine doesn't support tokenizer functions....but I guess thats easy enough to solve :)

Cheers :)
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Or a more trivial PHP class which knows only the rules which I stipulate earlier???
That one.

The PHP language isn't too hairy to deal with, but lexically speaking, why bother when you can have PHP's real lexer do it for you? I think, comparing the time tradeoff, that you'll get more bang for your buck installing a later version of PHP. I recommend 4.3.11.

I probably won't write one for you actually.

By the way...
Is that what Feyd meant? That was kinda the route I was hoping to avoid, because locating statements is JUST one task of many which I wanted to perform on the source code...
And how would you go about reusing that regexp? ;)
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Ambush Commander wrote:
Maybe i'll just use the PHP tokenizer
A very good idea. ;)
I can't say i'm familiar with what a string parser is???
You build it totally out of PHP. A search string parsing example can be found here (along with a competing, regexp solution) as well as another example built for parsing HTML.
Thats what I thought you/Feyd meant...

I haven't attempted anything of the like since my introduction to CFG grammars a few years back...now i'm spoiled...and would have a hard time spending time writing one by hand...

Not an ideal solution...but...

For speed it would certainly be better than regex...not to mention possible :)
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Quite a bit of post phasing, hmm? Well, read my earlier post. Tokenizing all the way.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Ambush Commander wrote:Quite a bit of post phasing, hmm? Well, read my earlier post. Tokenizing all the way.
Problem is...the verison on my computer is 2.4 or some stupid thing...so I don't have PHP tokenizing functions...

Speaking of which...

I have used phpDev for a while now, but clearly that project has fallen off the face of the earth and sucks...

Know of any other PHP triad project for Windows...which wouldn't require me to install a thing and work right from install with no configuring???

I am too lazy and don't have the time or interest to go learning anything past the basic understanding of PHP/MySQL/Apache administration...so phpDev was ideal for me...

Suggestions???
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Actually, it's really the MySQL setup (and making 4.1's passwords work with 4.0), which was the main problem with me. If you want, you can start a new thread and get your PHP up to date. You are missing out on a lot with such an ancient version.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Ambush Commander wrote:Actually, it's really the MySQL setup (and making 4.1's passwords work with 4.0), which was the main problem with me. If you want, you can start a new thread and get your PHP up to date. You are missing out on a lot with such an ancient version.
My website server has everything, but some times...I don't feel like cluttering my server with a bunch of projects...and then there's the fact...that some code...I like to keep confidential...having it on a shared host isn't a great idea :)

I think i'll check out that Xaamp (Apache friends) site :)
Post Reply