regex

REGEX for password validation

min 3 letters max 15 characters A-Za-z0-9 special charaters @#$%^&+= This is what I have: Regex.IsMatch(Password.Text, @"^[A-Za-z0-9@#$%^&+=]{3,15}$ ") It always returns false. Please help. ...

Haskell's Text.Regex.subRegex using TDFA implementation?

Is there a way to use the TDFA implementation of Regex with the functions in Text.Regex such as subRegex? The documentation says that Text.Regex must use the POSIX implementation only. ...

Nokogiri Element Removal Using Regex in Ruby

This seems like the hardest problem I have had yet, but maybe I am making it harder than it needs to be. I need to remove an unknown number of nested elements that may or may not be at the beginning of a sentence. The span elements contain a number of words in parentheses. So in the sentence: (cryptography, slang) An internet firewa...

check string for all lowercase letters in powershell

I want to be able to test if a powershell string is all lowercase letters. I am not the worlds best regex monkey, but I have been trying along these lines: if( $mystring -match "[a-z]^[A-Z]" ) { echo "its lower!" } But of course they doesn't work, and searching the interwebs hasn't got me anywhere. Does anyone know the way to do this...

Regex in GWT to match URLs

I implemented the Pattern class as shown here: http://www.java2s.com/Code/Java/GWT/ImplementjavautilregexPatternwithJavascriptRegExpobject.htm And I would like to use the following regex to match urls in my String: (http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))? Unfortunately, the Java compiler of course...

Most elegant way to strip and replace a String pattern

I am trying to strip and replace a text string that looks as follows in the most elegant way possible: element {"item"} {text { } {$i/child::itemno} To look like: <item> {$i/child::itemno} Hence removing the element text substituting its braces and removing text and its accompanying braces. These patterns may be ancounter...

Tricky PHP regex problem

Maybe not tricky for some, but tricky for me. I recently moved things around on my blog and I need to easily redirect users to the new pages. Previously, I had all of my articles linked like so: http://www.my-site.com/blog/my-article-title But I changed it to: http://www.my-site.com/blog/article/my-article-title I want to redirect ...

Pattern to find all the data between two words.

I am using the below pattern to find all the data between two words, placed in multiple lines. /START(.+?)END/ But this doesn't seems to work as expected. Can someone help me out with a exact pattern. Thanks. ...

Regex for spliting on all unescaped semi-colons

I'm using php's preg_split to split up a string based on semi-colons, but I need it to only split on non-escaped semi-colons. <? $str = "abc;def\\;abc;def"; $arr = preg_split("/;/", $str); print_r($arr); ?> Produces: Array ( [0] => abc [1] => def\ [2] => abc [3] => def ) When I want it to produce: Array ( [0] =...

Extracting 1 or more hyperlinks from paragraph text in Javascript using Regular Expression.

Hi Guys, Sorry to bother you guys again, but here's my dilemma. There must be a "better" regular expression to identify HTML link from a paragraph text (there can be more than 1 html links in the text). How do I extract all the link and anchor it in javascript? My attempt (in javascript) is like this: var urlPattern = "(https?|ftp):/...

Regular Expression to validate the field: field must contain atleast 2 AlphaNumeric characters

I need to validate VARCHAR field. conditions are: field must contain atleast 2 AlphaNumeric characters so please any one give the Regular Expression for the above conditions i wrote below Expression but it will check atleast 2 letters are alphanumeric. and if my input will have other than alphanumeric it is nt validating. '^[a-zA-Z0-9...

Help me to split string using RegExp

Hello, please help me this problem. I want to split "-action=1" to "action" and "1". string pattern = @"^-(\S+)=(\S+)$"; Regex regex = new Regex(pattern); string myText = "-action=1"; string[] result = regex.Split(myText); I don't know why result have length=4. result[0] = "" result[1] = "action" result[2] = "1" result[3] = "" Plea...

Regular Expression Help

Hello, I need a solution for a problem I am working on. I have a string which would be delivered to my application in the format below: ece4241692a1c7434da51fc1399ea2fa155d4fc983084ea59d1455afc79fafed What I need to do is format it for my database so it reads as follows: <ece42416 92a1c743 4da51fc1 399ea2fa 155d4fc9 83084ea5 9d1455af c...

Filename regex extraction

Hi, I'd like to get parts of the filename filenameblabla_2009-001_name_surname-name_surname I'd like to get: 2009-001, name_surname, name_surname I've come up with this, but it's no good preg_match("/(?:[0-9-]{8})_(?:[a-z_]+)-(?:[a-z_]+)/", $filename, $matches); Any pointers? Thanks! BR ...

Algorithm to search and replace delimited parameters

I have a string that contains multiple parameters delimited by #, like this : .... #param1# ... #param2# ... #paramN# ... And I want to replace the parameter placeholders by values. The current algorithm looks like this: //retrieve place holder into this SQL select Pattern p = Pattern.compile(DIMConstants.FILE_LINE_ESCAPE_IND...

PHP Regular Expression help

Hi, I'm trying to use preg_replace to remove all characters from a string except for numeric and period characters. I can remove everything but numbers, however how can I make an exception for the '.' period character. Can anyone help me out? Thanks. ...

c# search oracle table column for regex pattern

I'm trying to build an asp.net page using c# that will query a column in an Oracle database that has 20,000 rows. I want to display all rows that match this regular expression pattern "[\r\n]$".(should only have about 5 rows that match this pattern) The version of Oracle we use does not support regex so I need to find a way to do t...

Why my RegularExpressionValidator allows do not enter any text?

Why this code allows user do not enter any text? AFAIK + means One or more . <asp:TextBox ID="myTextBox" runat="server" MaxLength="9" /> <asp:RegularExpressionValidator runat="server" ControlToValidate="myTextBox" ValidationExpression="\d+" ErrorMessage="Error!" /> I want user was able to enter only 9 digits. And this field i...

Regular expression matching more than I need it to

I'm having some trouble trying to develop a regular expression which will pick out all the function calls to "tr" from this block of asp code below. Specifically I need to get the string in each "tr" function call. if(RS.Fields("Audid").Value <> 0 ) Then Response.Write ("<td>" & tr("RA Assigned") & "</td>") else ...

Regular Expression for URL

The regular expression posted below is used to pick up URLs, including ones in the format such as example.com. However, I want it only to pick up on URLs that have a www. or http, https, etc. in the front. In other words, it should pick up www.example.com. It should not pick up example.com. ((((ht|f)tp(s?))\://)?((www.|[a-zA-Z])([a-zA-Z...