regex

Regular Expression

Hi, I want .net regular expression for below thing: user can enter value tcm:12312312-221231323 or tcm:23121231-23423423-34234234 all the entry except "tcm" will be numeric. Please help! ...

Find and replace in files - .NET friendly regular expression syntax

I'm looking for a decent tool that can do search and replace over multiple files, with regular expression syntax I'm use to in C#. Normally I would do this in Visual Studio, except it has the strangest regex syntax (and this is meant to be faster than just replacing the text in the files manually). So far I've tried windows grep but it ...

Using regular expressions to parse HTML: why not?

It seems like every question on stackoverflow where the asker is using regex to grab some information from HTML will inevitably have an "answer" that says not to use regex to parse HTML. Why not? I'm aware that there are quote-unquote "real" HTML parsers out there like Beautiful Soup, and I'm sure they're powerful and useful, but if you...

Escaping a backslash in Batch File using FINDSTR

In my svn Pre commit hooks I use findstr to block certain file types beign committed. I now want to extend this to directories, in the first instance \obj\ directories however I am having problems with the Regular expression and escaping the \ of the dir Currently I have "C:\Program Files\VisualSVN Server\bin\svnlook.exe" changed -t ...

Please help me create a regular expression to parse my SQL statement

I want to extract FROM codes WHERE FieldName='ContactMethod' and IsNull(Deactived,'') != 'T' from SELECT FieldDescription,FieldValue FROM codes WHERE FieldName='ContactMethod' and IsNull(Deactived,'') != 'T' order by fielddescription using a regular expression. I have a regex like this: \FROM.*\order which extracts FROM cod...

Looking to replace option value="" with the text between <option value="">this text</option>

I have this html, and I want to replace the numeric value within value="##" with the value between <option>value</option> For example: <option value="16">Accounting</option>, I want to know the regex it'd take to automatically change it to <option value="Accounting">Accounting</option> I plan on doing it to this entire list. <option v...

Simple RegEx PHP

Since I am completely useless at regex and this has been bugging me for the past half an hour, I think I'll post this up here as it's probably quite simple. <a href="/folder/files/hey/">hey.exe</a> <a href="/folder/files/hey2/">hey2.dll</a> <a href="/folder/files/pomp/">pomp.jpg</a> In PHP I need to extract what's between the <a> tags...

A regex that validates a web address and matches an empty string?

The current expression validates a web address (HTTP), how do I change it so that an empty string also matches? (http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])? ...

Equal sign in Boost RegEx

Hello all, I've got a problem with the following Boost regular expression, boost::regex e("="); if(regex_search("=", e)) cout << "yeah"; Can anybody please tell me why I don't get a "yeah"? This is Boost 1.37 with Visual Studio 2008. Thank you very much in advance! ...

Regular expressions for non-strings

I was wondering if there is such a thing as regular expressions for sequential data that isn't a string. I know that regular expressions essentially boil down to DFAs, but I'm more interested in higher-level languages for specifying these DFAs. ...

Regex: problem creating matching pattern

Having some problems figuring out the regex to match this: function Array() { [native code] } I'm trying to only match the text that will occur where "Array" is. ...

In Eclipse Find/Replace-field can i alter the regexp-matched result $1?

I want to search and replace a lot of numbers in the range 0-9 and add one to them, so they become in the range 1-10 instead. for example: 0 3 5 would become: 1 4 6 In eclipse Find/Replace window I can match a number with ^([0-9]+)$ In the replace-field can I somehow add to the matched number $1? /G ...

How can I add * to the end of each line in Vim?

I tried the code unsuccessfully :%s/\n/*\n/g ...

Is Regex pattern a simple text or a rule?

Is there any relatively simple way to recognize Regex pattern as simple text or as a rule? Edit One example. @"[A-Z0-9]" - is a rule, and @"\[A-Z0-9\]" is a plain simple text (C# string syntax) ...

regular expression to split up searchphrase

I was hoping someone could help me writing a regex for c++ that matches words in a searchphrase, and explain it bit by bit for learning purposes. What I need is a regex that matches string within " " like "Hello you all", and single words that starts/ends with * like *ack / overfl*. For the quote part I have \"[\^\\s][\^\"]*\" but I c...

How do you comment html templates in Php (in a practical way) ?

Is there a simple solution to do the equivalent of Java's comments: <%-- this is a comment inside a template, it does not appear in the output HTML --%> Even if you use short php tags, you still have to wrap the comments with comment syntax, on top of the php tags: <? /* this is a comment of the html template */ ?> I'm considering ...

How to find a comma that is not inside parenthesis in a .net regular expression?

Hi, Using some extensions provided by .net, one can find groups of parenthesis by using something like this: ^(\w+)\(((?>[^()]+|\((?<D>)|\)(?<-D>))*(?(D)(?!)))\)(.*)$ This will match the following: Func(innerfunction(arg)).DoSomething() With the following groups: Group 1: Func Group 2: innerfunction(arg) Group 3: .DoSomething() ...

How to concisely cascade through multiple regex statements in Python

My dilemma: I'm passing my function a string that I need to then perform numerous regex manipulations on. The logic is if there's a match in the first regex, do one thing. If no match, check for a match with the second and do something else, if not check the third, and so forth. I could do something like this: if re.match('regex1', st...

Regular expression help

I have the following method in some nemerle code: private static getLinks(text : string) : array[string] { def linkrx = Regex(@"<a\shref=['|\"](.*?)['|\"].*?>"); def m = linkrx.Matches(text); mutable txmatches : array[string]; for (mutable i = 0; i < m.Count; ++i) { txmatches[i] = m[i].Value; } txmatc...

Open webpage and parse it using JavaScript

Hello ll, I know JavaScript can open a link in a new window but is it possible to open a webpage without opening it in a window or displaying it to the user? What I want to do is parse that webpage for some text and use it as variables. Is this possible without any help from server side languages? If so, please send me in a direction ...