asp.net mvc regular expression
(@"^\w+(?: \w+){0,8}$" the above regular expression restrict all the special characters except _ . how would i restrict it. ...
(@"^\w+(?: \w+){0,8}$" the above regular expression restrict all the special characters except _ . how would i restrict it. ...
Use Case: Take an HTML file with comments in a specific format (a format I specified), and change it to a JSP page that fills in these special areas with custom JSP code. Simple Example: <html> <!-- start:custom-title-content --> <h1>this is the generic title content used to develop the HTML page</h1> <!-- end:custom-title-content --...
Currently using: @"^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$ How can i make http:// not compulsory but if it does exist, it must be written as http:// ...
Hi, I need a regex for a password which meets following constraints in my rails project: have a minimum of 8 and a maximum of 16 characters be alphanumeric only contain at least one letter and one number. My current regex is: /^(?=.*\d)(?=.*([a-z]|[A-Z])).{8,16}$/ This allows me all the restrictions but the special characters pa...
Hi guys, I'm not very familiar to regex and even not able (maybe too tired?) to use this silly newby issue: I need a regex, that allows any combination of numbers, letters (lower and upper case) and the underscore _ BUT: The beginning of this regex shall be fix and defined in my source code:: ABC_h2u3h4l ABCijij4i5oi4j5 ABCABC Here ...
If I have a string like below... what is the regular expression to remove the (optional) leading and trailing double quotes? For extra credit, can it also remove any optional white space outside of the quotes: string input = "\"quoted string\"" -> quoted string string inputWithWhiteSpace = " \"quoted string\" " => quoted string...
Hi, i have this expression ([a-zA-Z]|ñ|Ñ)* which i want to use to block all characters but letters and Ñ to be entered on a textbox. The problem is that return a match for: A9023 but also for 32""". How can i do to return a match for A9023 but not for 32""". Thanks. ...
I need to convert a string like "string" to "*s*t*r*i*n*g*" What's the regex pattern? Language is Java. ...
I have a bunch of matches that I need to make, and they all use the same code, except for the name of the file to read from, and the regexp itself. Therefore, I want to turn the match into a procedure that just accepts the filename and regexp as a string. When I use the variable to try to match, though, the special capture variables st...
Hi, I have a problem with the regex of Zend_Json::prettyPrint. When in my JSON response I have a string with a comma inside like "stack, overflow" the string is splited in two: "stack, overflow" and I would like to have the string on the same line and not splited. In the file Zend/Json I found the regex: $tokens = preg_split('...
2 Regex question How can I match a word or 2 words in a subpattern ()? How can i match a word or 2 words that's either followed by a specific word like "with" OR the end of the string $ I tried (\w+\W*\w*\b)(\W*\bwith\b|$) but it's definitely not working edit: I'm thinking of matching both "go to mall" and "go to", in a way that ...
I'm working on a program that is running a series of regexs to attempt to find a date within the DOM from a webpage. For example, in www.engadget.com/2010/07/19/windows-phone-7-in-depth-preview/, I would match "Jul 19th 2010" with my regex. Things were going fine in multiple formats and languages until I hit an arabic webpage. As an ex...
Hi, I'm new to UNIX, having only started it at work today, but experienced with Java, and have the following code: #/bin/bash echo "Please enter a word:" read word grep -i $word $1 | cut -d',' -f1,2 | tr "," "-"> output This works fine, but what I now need to do is to check when word is read, that it contains nothing but letters and ...
This is the line mono on linux locks up (i am using 2.6.4 VM distro on the official site) var match = Regex.Match(sz, linkPattern); The string is this which gets the link and the title. var linkPattern = @"<\ba\b[^\>]*\bhref\b*=\b*""([^""\>]*)""[^\>]*\btitle\b*=\b*""([^""\>]*) by [^""\>]*"""; When mono hits that line it doesnt cras...
Using apache pig and the text hahahah. my brother just didnt do anything wrong. He cheated on a test? no way! I'm trying to match "my brother just didnt do anything wrong." Ideally, I'd want to match anything beginning with "my brother just" and end with either punctuation(end of sentence) or EOL. Looking at the pig docs, and then ...
I'm looking to split space-delimited strings into a series of search terms. However, in doing so I'd like to ignore spaces within parentheses. For example, I'd like to be able to split the string a, b, c, search:(1, 2, 3), d into [[a] [b] [c] [search:(1, 2, 3)] [d]] Does anyone know how to do this using regular expressions in Java...
I am running preg_replace across a string which may contain street numbers. The pattern I'm using is: ([A-Za-z0-9]*)/i This works fine for numbers such as 1, 1a, 123 etc. However it does not pick up street numbers like 1/54B I tried to add a forward slash to the pattern like this: ([A-Za-z0-9\/]*)/i But it isn't picking up number...
Hello, I absolutely hate RegEx, I really need to learn it - it's so powerful. Here's the issue: I'm trying to rewrite URLs in IIS, and I've got this default RegEx: ^([^/]+)/?$ However, that does let things like this business/profile.html through, but it lets business-profile.html through. How do I change it so that it lets the forme...
I'm alright with basic regular expressions, but I get a bit lost around pos/neg look aheads/behinds. I'm trying to pull the id # from this: [keyword stuff=otherstuff id=123 morestuff=stuff] There could be unlimited amounts of "stuff" before or after. I've been using The Regex Coach to help debug what I've tried, but I'm not moving for...
I have the following regular expression: SOMETHING(.*?),(1|0)\\); It needs to match SOMETHING then anything, then a comma, then 1 or 0 followed by ); but for some reason the last bracket isn't being matched, an example string: SOMETHINGdfsdfdsfd dsffdsdf dfsfds FEHEF777a ,0); the bold part is the ending. Am I escaping the ) wron...