|
|
Home /
Groups /
Regular Expressions (RegEx)
Parsing out Javascript Functions
I know nothing about regular expressions but I suddenly have a need. CanSteve Reich 08/15/06 02:34 A Funny, I would think you would only want the UUID, not the functionS. Isaac Dealey 08/15/06 11:56 A I know nothing about regular expressions but I suddenly have a need. Can someone please help me? I have a CF page that spits out a javascript function using UUID's (along with the rest of the regular HTML page code)... there are about 20-30 functions on my page. They are the same javascript function with a different UUID passed to them. How do I turn this: <a href='javascript:showPic("F2756593-0DDB-4C4C-B2474CA204C08ED3",640,480)'> ...into this: showPic("F2756593-0DDB-4C4C-B2474CA204C08ED3",640,480) ...using REGEX. For extra credit, what would be the easiest way to do a cfhttp and parse the entire page of HTML into a list of the functions. I want to pull out all of the javascript functions in the code to create a pipe separated list, to look something like this: showPic("someUUID-1",640,480)|showPic("someUUID-2",640,480)|showPic("someUUI D-3",640,480)|etc... I'm using CF5 on Windows 2003 Server. Thanks in advance, Steve Funny, I would think you would only want the UUID, not the function call around it, since the function call is always the same and the UUID is generally more useful... This would get you all the UUID's in a pipe delimited list: list = REReplaceNoCase(str,'.*showPic\("([^"]+)"',"\1|","ALL") This would get you all the function calls list = REReplaceNoCase(str,'.*(showPic\("[^"]+"[^)]*\))',"\1|","ALL") Or something close to these anyway. ----- Excess quoted text cut - see Original Post for more ----- s. isaac dealey 512.225.4227 new epoch : isn't it time for a change? add features without fixtures with the onTap open source framework http://www.fusiontap.com http://coldfusion.sys-con.com/author/4806Dealey.htm
|
Mailing Lists
|
Latest Fusion Authority Articles
|
||||||