aspnetguy Posted February 1, 2007 Share Posted February 1, 2007 Once again my pitiful RegExp skills have let me down.I need a regular expression that can find and <img> with <%=sHead_Logo%> somewhere in the src=""IE <img src="/images/<%=sHead_Logo%>" alt="Logo">Here is the pattern I have that is not working <img.*?<%=sHead_Logo%>.*?>Thanks. Link to comment Share on other sites More sharing options...
aspnetguy Posted February 1, 2007 Author Share Posted February 1, 2007 SOLVED:Arggg IE was the problem. The <img> was create ina Rich Text Editor and IE auto messup the code making it HTML 4.01 transitional and uppercasiing the tags. Also my expression was dying at the %> so I replaced all <%= with { and %> with } before comparing and the following pattern worked fine<[img|img].*?{sHead_Logo}.*?> Link to comment Share on other sites More sharing options...
vchris Posted February 1, 2007 Share Posted February 1, 2007 That's what I was gonna say but you beat me to it :)j/k lol I don't know what you're talking about. Link to comment Share on other sites More sharing options...
aspnetguy Posted February 1, 2007 Author Share Posted February 1, 2007 here is an overview: I am working with a CMS I wrote for our company. It has templates with "tags" in them that the CMS replaces with content. <%=tag name%>Well the templates are created visually with a Rich Text Editor on a webform. In IE, in the RTE, IE "rewrites the code", just like it does in Frontpage (grr) to HTML 4 Transitional meaning is uppercases all tags <img> becomes <IMG>, so my regexp pattern was checking for only lowercase thus the [img|img] (find upper or lowercase)also the end of the pattern was tring to find ">" but it found it at the end of the CMS tag %> not the end of the img tag. so I temporaily replaced the tag markers while search with regexp. Link to comment Share on other sites More sharing options...
jesh Posted February 1, 2007 Share Posted February 1, 2007 It sounds like you've solved it. Just in case you didn't know, most regular expression implementations seem to have a flag that you can set which turns off case-sensitivity. java script: var regex = /test/i; C# Regex regex = new Regex(@"test", RegexOptions.IgnoreCase); Link to comment Share on other sites More sharing options...
aspnetguy Posted February 1, 2007 Author Share Posted February 1, 2007 lol thanks, I should have guessed that. Link to comment Share on other sites More sharing options...
Sniffy Posted February 1, 2007 Share Posted February 1, 2007 Since this topic is over, but I'm still on the topic of Regex, I need information on the Java's Regex, how to import regex packages and make simple statements with it.I did a search before and haven't really found a reference, or basic guide to is which I want.I know (or rather have the basics) of regex in PHP & JS, do all I need really is to know how to use regex with Java.BTW: regex = regular expressions Link to comment Share on other sites More sharing options...
jesh Posted February 5, 2007 Share Posted February 5, 2007 This might get you started, Sniffy: http://www.regular-expressions.info/java.html Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now