regex

I need to remove Java Script tags using regular expressions and JRegex

I need to remove all the Java Script tags and the content in between and style tags from the HTML code of web pages.So far I've come up with this expression : "(<[ \r\n\t]*script([ \r\n\t>]|>){1,}([ \r\n\t]|.)*?</[ \r\n\t]*script[ \r\n\t]*>)|(<[ \r\n\t]*noscript([ \r\n\t>]|>){1,}([ \r\n\t]|.)*?</[ \r\n\t]*noscript[ \r\n\t]*>)|(<[ \r\n\t...

regular expression - function body extracting

Hi, in Python script, for every method definition in some C++ code of the form: return_value ClassName::MethodName(args) {MehodBody} I need to extract three parts: the class name, the method name and the method body for further processing. Finding and extracting the ClassName and MethodName is easy, but is there any simple way to ex...

Parse string with bash and extract number

Hello I've got supervisor's status output, looking like this. frontend RUNNING pid 16652, uptime 2:11:17 nginx RUNNING pid 16651, uptime 2:11:17 redis RUNNING pid 16607, uptime 2:11:32 I need to extract nginx's PID. I've done it via grep -P comman...

Matching Unicode Dashes in Java Regular Expressions?

I'm trying to craft a Java regular expression to split strings of the general format "foo - bar" into "foo" and "bar" using Pattern.split(). The "-" character may be one of several dashes: the ASCII '-', the em-dash, the en-dash, etc. I've constructed the following regular expression: private static final Pattern titleSegmentSeparator...

Using a RegEx in a SQL Query

Hey Everyone, Here's the situation I'm in: We have a field in our database that contains a 3 digit number, surrounded by some text. This number is actually a PK in another table, and I need to extract this out so I can implement a proper FK relationship. Here's an example of what would currently reside in the column: Some Text Goes ...

Regex not being greedy enough

I've got the following regex that was working perfectly until a new situation arose ^.*[?&]U(?:RL)?=(?<URL>.*)$ Basically, it's used against URLs, to grab EVERYTHING after the U=, or URL= and return it in the URL match So, for the following http://localhost?a=b&amp;u=http://otherhost?foo=bar URL = http://otherhost?foo=bar Unfortun...

Regex match an attribute value

Hi What would the regular expression be to return 'details.jsp' (without quotes!) from this original tag. I can quite easily match all of value="details.jsp" but am having trouble just matching the contents within the attribute. <s:include value="details.jsp" /> Any help greatly appreciated! Thanks Lawrence ...

regex find content question

Trying to use regex refind tag to find the content within the brackets in this example using coldfusion joe smith <[email protected]> The resulting text should be [email protected] Using this <cfset reg = refind( "/(?<=\<).*?(?=\>)/s","Joe <[email protected]>") /> Not having any luck. Any suggestions? Maybe a syntax issue, ...

Good starting point to learn regular expressions.

Possible Duplicate: Learning Regular Expressions I'm good at learning new languages and platforms, though whenever I try to learn Reg Ex I cannot make sense of it. I once even used the Regular Expression Designer to try and put some together. What's a good starting point to understanding what looks like the only rocket-scienc...

Using end of word mark with unicode in regular expressions in Python

The following matches in Idle, but does not match when run in a method in a module file: import re re.search('\\bשלום\\b','שלום עולם',re.UNICODE) while the following matches in both cases: import re re.search('שלום','שלום עולם',re.UNICODE) (Notice that stackoverflow erroneously switches the first and second items in the line above ...

JavaScript Regular expressions, match and replace link

Hello please help me <html> <body> http://domainname.com/abc/xyz.zip http://domainname2.com/abc/xyz.zip </body> </html> I want replace with link and out put like <html> <body> <a href="http://domainname.com/abc/xyz.zip"&gt;http://domainname.com/abc/xyz.zip&lt;/a&gt; <a href="http://domainname2.com/...

Regex Search and Replace in Eclipse: How do I fix dangling meta character 'x'?

I am trying to replace function calls written when methods were nonstatic to an updated version were they are. For example: TABLE_foo(table1, ...rest is the same with table1.foo(...rest is the same This is what I have come up with using my limited understanding of regex and this site. find: TABLE_(*)\((*), replace: $2.$1( The abov...

How do I best do balanced quoting with Perl's Regexp::Grammars?

Using Damian Conway's Regexp::Grammars, I'm trying to match different balanced quoting ('foo', "foo", but not 'foo") mechanisms -- such as parens, quotes, double quotes, and double dollars. This is the code I'm currently using. <token: pair> \'<literal>\'|\"<literal>\"|\$\$<literal>\$\$ <token: literal> [\S]+ This generally ...

C#: Loop through substring patterns in a string

my pattern is the following: {(code)} where code is a number (up to 6 digits), or 2 letter followed by a number. For example: {(45367)} {(265367)} {(EF127012)} I want to find all occurrences in a long string, I can't just use pure regex , because I need to preform some action when i find a match (like logging the position ...

JavaScript Split without losing character

I want to split certain text using JavaScript. The text looks like: 9:30 pm The user did action A. 10:30 pm Welcome, user John Doe. 11:30 am Messaged user John Doe Now, I want to split the string into events. i.e.: 9:30 pm The user did action A. would be one event. I'm using RegEx for this: var split = journals.split(/\d*\d:/); ...

Parsing complex string using regex

My regex skills are not very good and recently a new data element has thrown my parser into a loop Take the following string "+USER=Bob Smith-GROUP=Admin+FUNCTION=Read/FUNCTION=Write" Previously I had the following for my regex : [+\\-/] Which would turn the result into USER=Bob Smith GROUP=Admin FUNCTION=Read FUNCTION=Write FUNCT...

Javascript split with RegEx

Hey again, I just asked a question about Regex, and received a great answer: http://stackoverflow.com/questions/3047201/javascript-split-without-losing-character Now, I have another question. My current Regex looks like this: var split = text.split(/(?=\w*\d*\d:\d\d)/); Basically, I'm trying to split using the timestamps (eg - 9:3...

How to detect "Google Chrome" as the user-agent using PHP?

I'm interested to know whether the user-agent is "Chrome" at the server end using PHP. Is there a reliable regular expression for parsing out the user-agent string from the request header? ...

Regex - Format with tabs and alphabetical

Is it possible to use regex to turn this <site-ui:header title="error" backURL="javascript:history.go(-1);" /> into this <site-ui:header backURL="javascript:history.go(-1);" title="error" /> Basically, my goal is to format this xml so that the fields are in alphabetical order (e.g. backURL comes before title), and each field...

Online job-searching is tedious. Help me automate it.

Many job sites have broken searches that don't let you narrow down jobs by experience level. Even when they do, it's usually wrong. This requires you to wade through hundreds of postings that you can't apply for before finding a relevant one, quite tedious. Since I'd rather focus on writing cover letters etc., I want to write a program t...