regex

regex and javascript, some matches disappear !

Here is the code : > var reg = new RegExp(" hel.lo ", 'g'); > > var str = " helalo helblo helclo heldlo "; > > var mat = str.match(reg); > > alert(mat); It alerts "helalo, helclo", but i expect it to be "helalo, helblo, helclo, heldlo" . Only the half of them matches, I guess that's because of the space wich count only once. So I ...

Qt/C++ regular expression library with unicode property support

I'm converting an application from the .Net framework to Qt using C++. The application makes extensive use of regular expression unicode properties, i.e. \p{L}, \p{M}, etc. I've just discovered that the QRegExp class lacks support for this among other things (lookbehinds, etc.) Can anyone recommend a C++ regular expression library that:...

Regex: Filter out text before last occurrence

TEXT: R:\Everybody\OlegB\DiskCleaner\1\NewsFeed\Regional\Bray People_2010-04-14_v3.zip REGEX: (?<titleid>.*)_(?<issuedate>(19|20)[0-9]{2}[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01]))_v(?<layoutver>[0-9]*) I need apply REGEX to the following part of TEXT: Bray People_2010-04-14_v3.zip How can I filter out all text before last ...

Simple Regex Question

Hey Everyone, I need to search a bunch of files for anything that contains either "tblPayment" or "tblInvoice" I also want to match any tables named "tblPaymentMethod", "tblInvoiceItem", "tblInvoicePayment" Anybody care to help me out with how to write a regular expression for this? Thanks again! ...

Regular expression - starting and ending with a letter, accepting only letters, numbers and _

I'm trying to write a regular expression which specifies that text should start with a letter, every character should be a letter, number or underscore, there should not be 2 underscores in a row and it should end with a letter or number. At the moment, the only thing I have is ^[a-zA-Z]\w[a-zA-Z1-9_] but this doesn't seem to work proper...

python copytree with negated ignore pattern

I'm trying to use python to copy a tree of files/directories. is it possible to use copytree to copy everything that ends in foo? There is an ignore_patterns patterns function, can I give it a negated regular expression? Are they supported in python? eg. copytree(src, dest, False, ignore_pattern('!*.foo')) Where ! means NOT anything...

.Net, XML, & Regex - How to match a specific collection item?

So I have an xml file with the following simplified xml file contents: <CollectionItems> <CollectionItem> <Element1>Value1</Element1> <Element2> <SubElement1>SubValue1</SubElement1> <SubElement2>SubValue2</SubElement2> <SubElement3>SubValue3</SubElement3> </Element2> ...

Regular expression question

Please help me construct a regex to match: some text(x, x, x, x) where x can be any integer either positive or negative. I need it to match exactly as it is shown above. Each x can be a different positive or negative integer. ...

.Net Regular Expression

Alright so I want to grab the information on a website thats between [usernames] and [/usernames] I know how to get the string but how would I use regex to only have the information in the middle. Remember I am going to be having more then one thing on the page. ...

.NET Regex Instance Caching

I've read this article, which describes how instance vs static methods get called with a .NET regex. However, what about if the variable itself is static? Does anyone know if .NET does any sort of caching that could potentially cause a memory leak? Clarification. For example: public static Regex Foo = new Regex(@"(?:,.*)"); versus: ...

php Dollar amount Regular Expression

I am have completed javascript validation of a form using Regular Expressions and am now working on redundant verification server-side using PHP. I have copied this regular expression from my jscript code that finds dollar values, and reformed it to a PHP friendly format: /\$?((\d{1,3}(,\d{3})*)|(\d+))(\.\d{2})?$/ Specifically: if (...

Code Review: CLR RegexSubstring

Could this be better? .NET 2.0 compatibility for SQL Server 2005: public static SqlString RegexSubstring(SqlString regexpattern, SqlString sourcetext, SqlInt32 start_position) { SqlString result = null; if (!regexpattern.IsNull && !sourcetext.IsNull ...

Regular Expression For Consecutive Duplicate Words

I'm A Regular Expression Newbie, And I Can't Quite Figure Out How To Write A Single Regular Expression That Would "Match" Any Duplicate Consecutive Words Such As: Paris in the the spring. Not that that is related. Why are you laughing? Are my my regular expressions THAT bad?? Is There A Single Regular Expression That Will Match ALL ...

How can I match a null byte (0x00) in the Visual Studio binary editor with a find using a regular expression?

Open a file in the Visual Studio binary editor that contains a null byte (0x00), then use the Quick Find feature (Ctrl +F) to find null bytes. I would have thought I could use a regular expression such as \x00 to match null bytes but it doesn't work. Searching for any other hex value using this method works fine. Is this a VS bug, 'fea...

Regex to check if exact string exists

I am looking for a way to check if an exact string match exists in another string using Regex or any better method suggested. I understand that you tell regex to match a space or any other non-word character at the beginning or end of a string. However, I don't know exactly how to set it up. Search String: t String 1: Hello World, Nice...

Python program to search for specific strings in hash values (coding help)

Trying to write a code that searches hash values for specific string's (input by user) and returns the hash if searchquery is present in that line. Doing this to kind of just learn python a bit more, but it could be a real world application used by an HR department to search a .csv resume database for specific words in each resume. I'...

getting started with lex

I need to format some hexdump like this: 00010: 02 03 04 05 00020: 02 03 04 08 00030: 02 03 04 08 00010: 02 03 04 05 00020: 02 03 04 05 02 03 04 05 02 03 04 08 ‍ to 02 03 04 05 02 03 04 08 02 03 04 02 03 04 05 02 03 04 05 02 03 04 05 02 03 04 remove the address fields, if present remove any 08 at the end of a paragraph (followed ...

Jetty RewriteHandler and RewriteRegexRule

I'm trying to rewrite a URL for a servlet. The URL gets rewritten correctly, but the context doesn't match after that. Any idea how to get this to work? RewriteHandler rewriteHandler = new RewriteHandler(); rewriteHandler.setRewriteRequestURI(true); rewriteHandler.setRewritePathInfo(true); rewriteHandler.setOriginalPathAttribute("reques...

Most clever way to parse a Facebook OAuth 2 access token string

It's a bit late, but I'm disappointed in myself for not coming up with something more elegant. Anyone have a better way to do this... When you pass an OAuth code to Facebook, it response with a query string containing access_token and expires values. access_token=121843224510409|2.V_ei_d_rbJt5iS9Jfjk8_A__.3600.1273741200-569255561|TxQr...

What is the best way to remove multiple occurences of a character in a string in java

I have a string like foo..txt and I want to convert it to foo.txt The occurence of '.' may be more than 2 also. What is the best way to accomplish this? edit : The '.' may not occur just together. The occurences may be as below too foo.bar.txt = foo bar.txt foo..bar.foo.txt = foo bar.txt ...