regex

Javascript: Escape " from json string

Hi, I've got a bit of a problem. I'm currently working on converting an old system to a newer version. In the old version, data requests were managed by Java applets, which had no problems with the "-char in the data. Now, though, I'm fetching the data from a database and converting it to a JSON-string using XSLT, and then - with the pro...

regular expression help

I need to match the following pattern: return character 5 character string, A-Z, 0-( space For example: ABC65 CG876 Each with a return character before and a space after. What regular expression should I use for this? Using PHP ...

Why does this regular expression match?

I have this regex: (?<!Sub ).*\(.*\) And I'd like it to match this: MsgBox ("The total run time to fix AREA and TD fields is: " & =imeElapsed & " minutes.") But not this: Sub ChangeAreaTD() But somehow I still match the one that starts with Sub... does anyone have any idea why? I thought I'd be excluding "Sub " by doing (?<!Sub ...

How to extract the url+parameters out of a bbcode url tag?

The following code outputs: http://www.google.com http://www.google.com&amp;lang What is the simplest way to change the code so it outputs: http://www.google.com http://www.google.com&amp;lang=en&amp;param2=this&amp;param3=that CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace...

c++ search text n boolean mode

Hi, basically have two questions. 1. Is there a c++ library that would do full text boolean search just like in mysql. E.g., Let's say I have: string text = "this is my phrase keywords test with boolean query."; string booleanQuery = "\"my phrase\" boolean -test -\"keywords test\" OR "; booleanQuery += "\"boolean search\" -mysql ...

Sort search results from text file into listbox

Hi scene! what i have is a textbox into which the user types a string. The string will look something like this: G32:04:20:40 Then the user hits the search button. The program must then open a textfile and search for the "nearest" five strings to the one they entered and display them in a listbox. I'll define "nearest string" as much ...

How can i write the regex "All characters are the same"?

I would like it to match: aaaaaa bb c but not: aaabaaa cd ... ...

What are good Perl Pattern-matching / Regex Modules?

I've been having a need to do a lot of regex / pattern-matching stuff lately and, in looking at different examples / forum posts from my web searches it seems people sometimes mention that perl has good modules to help in simplifying pattern matching / regex tasks, however they neglect to mention which ones are the best for this.. I have...

using a matched expression as a starting point for a match

I'm using http://regexpal.com/ and some of the look-ahead and look-behind are not supported in JavaScript. is it still possible to use a matched criteria to signal the beginning of a match, and another for the end, without being included in the match. for example, if I'm using [tag] to only get the tag, or if I have {abc 1,def} to matc...

PHP: how to create an regexp to preg_match() for PT Mobile phones?

Hi all, i'm newer related to Regexp on PHP... I need to create an Regexp to filter Portuguese Mobile Phones, can anybody help me and explain how i do it? (To i understand it) Rules: The integer/string must have 9chars; The first char must be a '9'; The second one can be '1,2,3,6' (Chars are separeted by commas); The other chars must b...

TSQL Like regular expression

Hello I'm trying to select only entries in the following format from a varchar field. [any number of zeros][a hyphen or not][any number of numbers] some samples of what I want would be... 000000000007975 000000000-58628 123421423890347 But not 00000--18945489 00000000000012B SELECT Field FROM table WHERE Field LIKE ??? ...

Why isn't regular expressions part of ISO C99

Everyone knows how awesome C language is and how much it sucks in text processing tasks. Given these facts. Regex definitely must be part of ISO C. But it isn't. I don't understand why? Are there people who think its not essential? ...

strings with wildcards matching

Hi all I need to match two strings with simple wildcards: "oh.my.*" matches "*.my.life", "oh.my.goodness" and "*.*.*", but not "in.my.house" The only wildcard is *, which substitutes string of any character (minus .) I thought of using fnmatch, but it does not accept wildcards in file name. There is some code with regex which i am u...

Help with regular expression in PHP

I want to know if a string is in another string at least once. I want to check if Shadowbox.init then any (optionnal) combisaison of whitespace then ( is inside $myString at least once. Shadowbox.init must be found (case sensitive) It can be followed by any number of white spaces (spaces, tabs, newlines...) The whitespaces or init is ...

RegEx get all characters before

I have this regular expression to get urls: (((ht|f)tp(s?))\://)?(www.|[a-zA-Z].)[a-zA-Z0-9-.]+.(com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk)(\:[0-9]+)*(/($|[a-zA-Z0-9.\,\;\?\'\+&%\$#\=~_-]+))* And I want to modify it so that when I call to make an array of the matched strings it will get everything before it as well. How ...

Regex to include all intranet sites but exclude http(s)://localhost

Hi, I am trying to come up with a JS regex that will include any intranet site (with the simple definition of any host name that does not include .), but will exclude localhost. I've got the first part: http(s)?\:\/\/[^\.\/]+(\/.*)* I am struggling with the second part. Any help would be appreciated. ...

Regular Expression to check string is in particular format

hi, can someone please help me to compose a regular expression to check an alphanumeric string is in a particular format. First character must be a letter and the next 6 characters are numbers...eg x279833 or X279833 are both valid. This is what i've come up with - ^[A-Za-z]{1}[0-9]{6}$ regards ...

How to represent a fix number of repeats in regular expression?

Hi all, I am wondering if there is a better to represent a fix amount of repeats in a regular expression. For example, if I just want to match exactly 14 letters/digits, I am using ^\w\w\w\w\w\w\w\w\w\w\w\w\w\w$ which will match a word like UNL075BE499135 and not match UNL075BE499135AAA is there a handy way to do it? In am currently doin...

Java regular expression for binary string

First, I need to read a binary String from file into memory - how ? To read I tried nio.CharBuffer, and then byte[]. But later I need to get a binary String with all possible binary data to do regular expression on, so it was not a success. Then, I need to extract binary sequences from this binary string and save them in each separate b...

Compact Clojure code for regular expression matches and their position in string

Stuart Halloway gives the example (re-seq #"\w+" "The quick brown fox") as the natural method for finding matches of regex matches in Clojure. In his book this construction is contrasted with iteration over a matcher. If all one cared about were a list of matches this would be great. However, what if I wanted matches and their positio...