regex

How do I create a regular expression to accept not more than 10 digits?

How do I create a regular expression to accept not more than 10 digits? thanks ...

Finding incorrectly-formatted email addresses in a CSV file

I've got a CSV file full of contact information and I'm trying to load it into GMail contacts, but the e-mail addresses aren't all correctly formatted so GMail doesn't recognise it as an e-mail field. I can open the CSV file in Excel (Mac) but I don't know if there's a way of pattern matching in Excel. Also, some of the fields may contai...

Finding connection strings in code programatically

Seems like a fairly straightforward problem. I want to look through about 6gb of content and classic asp code and find anything that looks like a connection string. Problem is, the connection strings are formatted in a dozen different ways. I was thinking of using a regex to look for specific properties like "catalog=" or "password=" ...

Regular Expression FS00000

What is the regular expression to match FS00000 were the 0s can be a number from 0-9. There can only be 5 numbers following the FS. ...

How to change XML based on regex matches to text (character data)

I am trying to match the text contents(character data) of an XML file with a series of regexs and then change the XML based on the matches. Example: <text> <para>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </para> </text> I want to match for instance ...

sed to replace random site urls in ifrrame

Hello, my problem there is alot of pages infacted with iframe each one of them have different url or different id here is example <iframe src="http://xxxxxx.xxxx/xxxx.xxx" width=xxx height=xxx style="visibility: hidden"><iframe> or <iframe src="http://xxxxxx.xxxx/xxxx.xxx?xxx=xxxx" width=xxx height=xxx style="visibility: hidden">...

How do I access captured substrings after a successful regex match in Perl?

I am searching for a string in Perl and storing it in another scalar variable. I want to print this scalar variable. The code below doesn't seem to work. I am not sure what is going wrong and what is the right way to go about it. Why is it printing '1' when it doesn't exist in the program? Data it is running on DATA 13 E 0.496 ...

What regular expression would match this data?

I have the following within an XHTML document: <script type="text/javascript" id="JSBALLOONS"> function() { this.init = function() { this.wAPI = new widgetAPI('__BALLOONS__'); this.getRssFeed(); }; } </script> I'm trying to select everything in between the two script tags. The id will al...

Using Regex to remove Carriage Returns in a CSV file in Notepad++

I have a CSV file I need to clean up. This is a one-time thing so I'd like to do it in Notepad++ if possible. The CSV file has two fields, one of which is wrapped in quotes. I'd like to remove any Carriage Returns from within the quoted field. I was trying to use this pattern but can't get it quite right... (.*)\"(.*)\n(.*)\"(.*) Als...

Regex with multiple newlines in sequence

I'm trying to use PHP's split() (preg_split() is also an option if your answer works with it) to split up a string on 2 or more \r\n's. My current effort is: split("(\r\n){2,}",$nb); The problem with this is it matches every time there is 2 or 3 \r\n's, then goes on and finds the next one. This is ineffective with 4 or more \r\n's. I...

What does $1 mean in Perl?

What does $1 mean in Perl? Further, what does $2 mean? How many $number variables are there? ...

Regular expression for user control

Possible Duplicate: How do I create a regular expression to accept not more than 10 digits? I want a regular expression which will allow up to 10 digits in a user control having a text box. (ASP.net 3.5). ...

Would this regular expression work?

^([a-zA-Z0-9!@#$%^&*|()_\-+=\[\]{}:;\"',<.>?\/~`]{4,})$ Would this regular expression work for these rules? Must be atleast 4 characters Characters can be a mix of alphabet (capitalized/non-capitalized), numeric, and the following characters: ! @ # $ % ^ & * ( ) _ - + = | [ { } ] ; : ' " , < . > ? / It's intended to be a password v...

How to replace forwardslashes with backslashes in a string in lisp for emacs?

I would like to replace forward slaches to backslashes in emacs lisp. If I use this : (replace-regexp-in-string "\/" "\\" path)) I get an error. (error "Invalid use of `\\' in replacement text") So how to represent the backslash in the second regexp? ...

Extract keywords/tags from string using Preg_match_all

I have the following code $str = "keyword keyword 'keyword 1 and keyword 2' another 'one more'".'"another keyword" yes,one,two'; preg_match_all('/"[^"]+"|[^"\' ,]+|\'[^\']+\'/',$str,$matches); echo "<pre>"; print_r($matches); echo "</pre>"; Where I want it to extract keywords from a string, and keep those wrapped within single or do...

Are there particular cases where native text manipulation is more desirable than regex?

Are there particular cases where native text manipulation is more desirable than regex? In particular .net? Note: Regex appears to be a highly emotive subject, so I am wary of asking such a question. This question is not inviting personal/profession opinions on regex, only specific situations where a solution including its use is not as...

Php parse links/emails

Hello, I am wondering if there is a simple snippet which converts links of any kind: http://www.cnn.com to <a href="http://www.cnn.com"&gt;http://www.cnn.com&lt;/a&gt; cnn.com to <a href="http://www.cnn.com"&gt;cnn.com&lt;/a&gt; www.cnn.com to <a href="http://www.cnn.com"&gt;www.cnn.com&lt;/a&gt; [email protected] to to <a href="mailto:mail...

Regex to change to sentence case

I'm using Notepad++ to do some text replacement in a 5453-row language file. The format of the file's rows is: variable.name = Variable Value Over Here, that''s for sure, Really Double apostrophe is intentional. I need to convert the value to sentence case, except for the words "Here" and "Really" which are proper and should remain c...

RegEx Expression Help

Hello, I need a regular expression that will not let someone continue to check out if the type in the word 'box' or 'Box' or 'BOX' followed by numbers. Both conditions have to be met for this to work, the word box and the numbers not one or the other. Does anyone know how to write this? EDIT: Hey guys, I've tried a few and the problem...

regex for search and replace

Hi i'm doing a seach and replace and need to replace all characters that are NOT a comma "," how do i search for all characters in any order eg string, like , this becomes replace,replace,replace, thanks M ...