regex

Finding all occurrences of a sequence of chars when preceded by a specific string

Hi, I'm trying to extract all matches from a EBML definition, which is something like this: | + A track | + Track number: 3 | + Track UID: 724222477 | + Track type: subtitles ... | + Language: eng ... | + A track | + Track number: 4 | + Track UID: 745646561 | + Track type: subtitles ... | + Language: jpn ... I want all occurr...

What objects can be tested with Regular Expressions in C#

Could someone please tell me which objects types can be tested using Regular Expressions in C#? ...

How do you match only valid roman numerals with a regular expression?

Thinking about my other problem, i decided I can't even create a regular expression that will match roman numerals (let alone a context-free grammar that will generate them) The problem is matching only valid roman numerals. Eg, 990 is NOT "XM", it's "CMXC" My problem in making the regex for this is that in order to allow or not allow...

Regular Expressions in SQL Server servers?

Is it possible to make efficient queries that use the complete regular expression feature set. If not Microsoft really should consider that feature. ...

RegEx to return 'href' attribute of 'link' tags only?

Im trying to craft a regex that only returns <link> tag hrefs Why does this regex return all hrefs including <a hrefs? (?<=<link\s+.*?)href\s*=\s*[\'\"][^\'\"]+ <link rel="stylesheet" rev="stylesheet" href="idlecore-tidied.css?T_2_5_0_228" media="screen"> <a href="anotherurl">Slash Boxes</a> thank you ...

Can I optimize this phone-regex?

Ok, so I have this regex: ( |^|>)(((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{2})(-)?( )?)?)([0-9]{7}))|((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{3})(-)?( )?)?)([0-9]{6}))|((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{1})(-)?( )?)?)([0-9]{8})))( |$|<) It formats Dutch and Belgian phone numbers (I only want those hence the 31 and 32 as count...

Regex in awk and WinGrep

So I'm looking for a pattern like this: size='0x0' in a log file - but I'm only interested in large sizes (4 digits or more). The following regex works great in EditPadPro (nice tool BTW) size='0x[0-9a-fA-F]{4,} But the same regex does not work in awk - seems like the repetition {4,} is messing it up. Same with WinGrep - any idea fr...

Remove the Query String from a Url in HTML with a Regular Expression

Given a html document, what is the most correct and concise regular expression pattern to remove the query strings from each url in the document? ...

regex for html parsing (in c#)

Hello, I'm trying to parse a html page and extract 2 values from a table row. The html for the table row is as follows: - <tr> <td title="Associated temperature in (ºC)" class="TABLEDATACELL" nowrap="nowrap" align="Left" colspan="1" rowspan="1">Max Temperature (ºC)</td> <td class="TABLEDATACELLNOTT" nowrap="nowrap" align="Center" colsp...

Regular expression for searchterms not preceded or followed by [a-z] and [A-Z]

Can someone supply me with the regexp for searching for a searchterm that is not preceded or followed by [a-z] and [A-Z], other characters are ok. -> i.e. when searching for 'key' i don't want keyboard in my searchresults but key. is okay. Thanks! ...

Add spaces before Capital Letters

Given the string "ThisStringHasNoSpacesButItDoesHaveCapitals" what is the best way to add spaces before the capital letters. So the end string would be "This String Has No Spaces But It Does Have Capitals" Here is my attempt with a RegEx System.Text.RegularExpressions.Regex.Replace(value, "[A-Z]", " $0") ...

How to parse logs written by multiple threads?

I have an interesting problem and would appreciate your thoughts for the best solution. I need to parse a set of logs. The logs are produced by a multi-threaded program and a single process cycle produces several lines of logs. When parsing these logs I need to pull out specific pieces of information from each process - naturally this i...

Regex for numbers only

I haven't used regular expressions at all, so I'm having difficulty troubleshooting. I want the regex to match only when the contained string is all numbers; but with the two examples below it is matching a string that contains all numbers plus an equals sign like "1234=4321". I'm sure there's a way to change this behavior, but as I said...

How do you implement a good profanity filter?

Many of us need to deal with user input, search queries, and situations where the input text can potentially contain profanity or undesirable language. Oftentimes this needs to be filtered out. Where can one find a good list of swear words in various languages and dialects? Are there APIs available to sources that contain good lists? ...

Is there a version of JavaScript's String.indexOf() that allows for regular expressions?

In javascript, is there an equivalent of String.indexOf() that takes a regular expression instead of a string for the first first parameter while still allowing a second parameter ? I need to do something like str.indexOf(/[abc]/ , i); and str.lastIndexOf(/[abc]/ , i); While String.search() takes a regexp as a parameter it does n...

C# Parsing Best Practices

Hey Folks ! I need to parse some known file formats, one of them is the CUSCAR format, i strongly believe that RegEx will do the job ,any suggestions ? ...

Random Text generator based on regex

Hello. I would like to know if there is software that, given a regex and of course some other constraints like length, produces random text that always matches the given regex. Thanks ...

Regular expressions: Differences between browsers

I'm increasingly becoming aware that there must be major differences in the ways that regular expressions will be interpreted by browsers. As an example, a co-worker had written this regular expression, to validate that a file being uploaded would have a PDF extension: ^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.pdf)$ This works in In...

What is the regular expression for /urlchecker/http://www.google.com

I'm writing a url rewrite in django that when a person goes to http://mysite.com/urlchecker/http://www.google.com it sends the url: http://ww.google.com to a view as a string variable. I tried doing: (r'^urlchecker/(?P<url>\w+)/$', 'mysite.main.views.urlchecker'), But that didn't work. Anyone know what I'm doing wrong? Also, gene...

Regex for names.

Hi there. Just starting to explore the 'wonders' of regex. Being someone who learns from trial and error, I'm really struggling because my trials are throwing up a disproportionate amount of errors... My experiments are in PHP using ereg(). Anyway. I work with first and last names separately but for now using the same regex. So far...