regex

PHP Currency Regular Expression

Hi All I am trying to find a piece of regex to match a currency value. I would like to match only numbers and 1 decimal point ie Allowed 10 100 100.00 Not Allowed Alpha Characters 100,00 +/- 100 I have search and tried quite a few without any luck. Hope you can advise ...

Help Refining RegEx (\bL\s*\d{6}\s*\d{7}\b)

This is a followup to an earlier question (http://stackoverflow.com/questions/814042/help-refining-regex-b-d6-1-15-d7-b). The goal is to get the Lat/Lon from the file. This is denoted by an L or the pattern of 6d/7d. I incorrectly stated that there could not be an alpha between start of the Lat (305455) and the Lon (1025446). When I i...

is it possible to use regex in c++?

Duplicate of: There is a function to use pattern matching (using regular expressions) in C++? I'm not sure where one would use it... are there any parser-type functions that take some regex as an argument or something? I just found out that my editor will highlight a line after / as "regex" for C/C++ syntax which I thought was weird... ...

What Perl regex can match CamelCase words?

I am searching the following words in .todo files: ZshTabCompletionBackward MacTerminalIterm I made the following regex [A-Z]{1}[a-z]*[A-Z]{1}[a-z]* However, it is not enough, since it finds only the following type of words ZshTab In pseudo code, I am trying to make the following regex ([A-Z]{1}[a-z]*[A-Z]{1}[a-z]*){1-9} Ho...

Removing redundant line breaks with regular expressions

Hello, I'm developing a single serving site in PHP that simply displays messages that are posted by visitors (ideally surrounding the topic of the website). Anyone can post up to three messages an hour. Since the website will only be one page, I'd like to control the vertical length of each message. However, I do want to at least par...

Match uneven number of escape symbols

I need to match C++ preprocessor statements. Now, preprocessor statements may span multiple lines: #define foobar \ "something glorious" This final backslash may be escaped so the following results in two separate lines: #define foobar \\ No longer in preprocessor. The question is how I can match the explicit line continuation ...

How to append variables to a url which already has variables?

Hi all, So, the situation I'm currently in is a wee bit complicated (for me that is), but I'm gonna give it a try. I would like to run to a snippet of HTML and extract all the links referring to my own domain. Next I want to append these URL's with a predefined string of GET vars. For example, I want to append '?var1=2&var2=4' to 'ht...

Delete digits in Python (Regex)

I'm trying to delete all digits from a string. However the next code deletes as well digits contained in any word, and obviously I don't want that. I've been trying many regular expressions with no success. Thanks! s = "This must not b3 delet3d, but the number at the end yes 134411" s = re.sub("\d+", "", s) print s Result: This...

How can I search patterns in Screen with a Perl regex?

I have a process which gives me continuously output in Screen. I want to search CamelCase words by the following Perl's regex in the output such that I can monitor actively the outputs. /\b([a-z]*[A-Z][a-z]*){2,}\b/ ...

What are alternatives to regexes for syntax highlighting ?

While editing this and that in Vim, I often find that its syntax highlighting (for some filetypes) has some defects. I can't remember any examples at the moment, but someone surely will. Usually, it consists of strings badly highlighted in some cases, some things with arithmetic and boolean operators and a few other small things as well....

Python: Replace string with prefixStringSuffix keeping original case, but ignoring case when searching for match

So what I'm trying to do is replace a string "keyword" with "<b>keyword</b>" in a larger string. Example: myString = "HI there. You should higher that person for the job. Hi hi." keyword = "hi" result I would want would be: result = "<b>HI</b> there. You should higher that person for the job. <b>Hi</b> <b>hi</b>." I will not...

Spliting a file into lines in Python using re.split

I'm trying to split a file with a list comprehension using code similar to: lines = [x for x in re.split(r"\n+", file.read()) if not re.match(r"com", x)] However, the lines list always has an empty string as the last element. Does anyone know a way to avoid this (excluding the cludge of putting a pop() afterwards)? ...

stripping an url from a text

How do I get to strip a url and put it back in the same position? ...

.NET BindingSource.Filter with regular expressions

hello, i am using a BindingSource.Filter to list only certain elements of the datasource. especially i use it like this a lot: m_bindingSourceTAnimation.Filter = "Name LIKE '" + FilterText + "'"; now my question is, if it is somehow possible to use regular expressions with these filters. i would especially need multiple wildcard (*) ...

How can I get multiple memories from a Perl regex match?

The purpose of the regex search is to determine all template class instances from C++ header files. The class instances can be formarted such as: CMyClass<int> myClassInstance; CMyClass2< int, int > myClass2Instacen; The search is performed by loading the entire file into a string: open(FILE, $file); $string = join('',<FILE>); close...

How to split a comma separated String while ignoring escaped commas?

I need to write a extended version of the StringUtils.commaDelimitedListToStringArray function which gets an additional parameter: the escape char. so calling my: commaDelimitedListToStringArray("test,test\\,test\\,test,test", "\\") should return: ["test", "test,test,test", "test"] My current attempt is to use String.split() to s...

How do you use Notepad++ regex pipe | for strings longer than one character?

I'm trying to get notepad++ to regex find all instances of "abc" and "def" in the following sentence: The abc went to the def. None of the following syntaxes seem to work: abc|def [abc|def] (abc)|(def) (abc|def) NOTE: "[a|d]" matches any instance of "a" or "d" when I tested ...

C# regex match only parts of complete words in string

Hello, Before asking this question I have Googled for this problem and I have looked through all StackOverflow related questions. The problem is pretty simple I have a string "North Atlantic Treaty Organization" I have a pattern "a.*z", at moment it would match north ATLATIC TREATY ORGANIZation But I need it to match complete words...

I need a regex to get the src attribute of an img tag

Hi, I have a string which follows literally: "lt;img src=quot;http://www.news.gov.tt/thumbnail.php?file=Hon__Jerry_Narace_Minister__Of_Health_599152837.jpgamp;size=summary_mediumquot;gt;lt;pgt;Fifty-eight people have been tested for Influenza A/H1N1 virus, commonly called swine flu, in Trinidad and Tobago. \r\nThe tests have all come ...

regular expression to remove links

I have a HTML page with <a class="development" href="[variable content]">X</a> The [variable content] is different in each place, the rest is the same. What regexp will catch all of those links? (Although I am not writing it here, I did try...) ...