Custom Html/wml Parser

Started on the old forum in May 2008 · view the original in the archive · old links redirect here

5 replies · 562 views · started 18 years ago · 1 min read

Guest #1

hey,

In short, im looking to build a script that will 'parse' markup languages - more specifically, wml and (x)html.

By 'parse', I mean that it will hunt through any given source code and then split it into individual tags. This is where I've hit a roadblock in productivity, however; I'm somewhat unfamiliar with regexp and perhaps I'm missing the 'correct' search terms but google searches for similar projects over the past week have been so far unfruitful.

I do not want the script to be made for me, instead I would like help/guidance on where to begin and what pitfalls I should avoid. If someone feels like they want a challenge or has a script readymade they would like to share, I won't say no to it, but I'd rather learn how to do it myself External image (may be gone) External image (may be gone) .

Thanks, Kwah =]

btw.. The 'long' background is that I'm building a file-editing program so that I can (using PHP & FTP) manage and edit files in a given directory. After the file has been selected, it should show a list of each tag very similarly to how wen.ru does it, but I'm going to take it slightly further in a way that I'm not going to release just yet External image (may be gone)

Guest #2

lol if you dont know where to start searc google for

php str_replace php preg_match php preg match_all php preg_replace

and learn regex on this site

http://www.regular-expressions.info/php.html

I have made plenty of parsers for all sorts in php and c++ php its far easier and could be done within a couple of hours if you gain the right knowledge,

Best Regards, Wap2k

Guest #3

Thanks rich - its good to see there are some good helpful people here still =] Haven't been around in a while and I got kinda disheartened to see so much spam 😀

I know about the string replacement functions and have used them before but its more the practical aspects of regexp that I have trouble with.

By the way, just out of curiosity, does anybody know if programmers in countries that use non-unicode characters (China, for example), program (X)HTML/WML etc in latin fonts? ie, using letters instead of 'pictures'.

Either way, it looks like I'll be using mb_ereg since the source code may/may not use multi-byte input but I'll never know when/if it does. :S

Thanks for the link, Kwah =]

Guest #4

Rusians use encoded text almost like special chars in html but all the charectors can't tell you wehat its calles off the top of my head and yes they can use fonts and chinese picture text isn't usally used on html even though i have seen it i don't think anyway it is anyway

Guest #5

I think I'm going to stick to latin characters for now, adding a check for non-Unicode/UTF characters later External image (may be gone)

Too much hassle tbh..

Thanks Kwah

Guest #6

true im gonna do a new wapsite and do it in so many languges later, Good Luk mate

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close