Hi,
I am using the following regex to validate an email address:
"^[-a-zA-Z0-9][-.a-zA-Z0-9]*@[-.a-zA-Z0-9]+(\.[-.a-zA-Z0-9]+)*\.(com|edu|info|gov|int|mil|net|org|biz|name|museum|coop|aero|pro|[a-zA-Z]{2})$"
Unfortunately, this does not allow email addresses with hyphens underscores. Ex.:
[email protected]
How can I modify th...
Since there is no function to check whether a string is escaped before entering it to the db, how can I do this with regex?
$string = 'some" string';
if(!preg_match('//',$string))
{
$string = mysqli_real_escape_string($string);
}
php manual:
mysqli_real_escape_string backslashes characters encoded NUL (ASCII 0), \n, \r, \, ', ...
Is there a way that the Regex will check the first and the last character, but will replace only the IV and not the spaces.
Regex.Replace("This is IV item.", "[^A-Za-z0-9](IV)[^A-Za-z0-9]", "fourth");
Please don't tell me about MatchEvaluator and other Match based things, I need a one line solution, and one line doesn't mean combining...
Good day.
Is there a simple way to return regexp matches as an array?
Here is how I am trying in 2.7.7:
val s = """6 1 2"""
val re = """(\d+)\s(\d+)\s(\d+)""".r
for(m <- r.findAllIn(s)) println(m) // prints "6 1 2"
r.findAllIn(s).toList.length // 3? No! It returns 1!
But I then tried:
s match {
case r(m1, m2, m3) => println(m1)
}
...
Hello,
I've a string "This text has some (text inside parenthesis)". So i want to retrieve the text inside the parenthesis using Regular Expressions in C#. But parenthesis is already a reserved character in regular expressions. So how to get it?
Update 1
so for the text "afasdfas (2009)"
i ried (.)/s((/d+)) and (.) (\d+) and (.*)/s(...
I'm trying to find the regular expression to find just the alphanumeric words from a string i.e the words that are a combination of alphabets or numbers. If a word is pure numbers or pure characters I need to discard it.
...
So I have an Apache .htaccess file that contains this:
RewriteEngine On
RewriteRule ^/(javascript/.*)$ /$1 [L]
RewriteRule ^/(styles/.*)$ /$1 [L]
RewriteRule ^.*$ /index.php
Unfortunately, the last line's coughing up a 500 error on the server that we've moved the code to. It works fine on my machine, Ubuntu 9.10 running Apache 2.2.12,...
Is it possible to write a regular expression which matches regular expressions? Does anyone have examples? If there is some theoretical obstruction, does anyone know of a regex which will match at least the most common regex patterns?
...
Hi,
I'm currently using the following regular expression to validation URLs:
^(?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~\/|\/)?(?#Username:Password)(?:\w+:\w+@)? (?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|edu|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:...
Need a regular expression to check if webpage has special characters in the comments field.
Comments should only have characters,numbers and @ = - ' " . i inside the comments.
I am using C#.net to check it
THis is the code I have and it does not work
if (!Regex.IsMatch(comments.Text,@"^[a-zA-Z''-'\s]$"))
{
lblError.Text = "Ple...
Hi all -- I have two files I've been trying to compare with diff. The files are automatically generated and feature a number of lines that look like:
//! Generated Date : Mon, 14, Dec 2009
I'd like those differences to be ignored, and have set out to use the "-I REGEX" flag to make that happen.
However, the number of spaces that a...
Regular expression for negative and positive decimal value so that can be
matched with string using pattern and matcher for the correct implementation
can any one will provide me with that
...
Calling regex gurus. I'm having some trouble right now with escaping a string in Ruby so that I can pass it into a command line utility using exec, %x{} or similar. The command line command is the TextMate dialog feature, which basically works like this (Run this as a shell script in TextMate.):
$DIALOG -mp "items=('string1','string2', ...
Hi Everyone
I would like to redirect several domains to our dotcom address.
The domains have the following extensions:
cn
jp
ch
eu
fr
www.domain.fr should point to www.domain.com - sub.domain.fr should point to sub.domain.com and the path after the extension should stay intact so that www.domain.fr/foo points to www.domain.com/foo
...
I have this regex (\d{4})-(\d{2})-(\d{2}) to detect a valid date, however, it is not perfect as some of the incoming data are 2009-24-09 (YYYY-DD-MM) and some are 2009-09-24 (YYYY-MM-DD).
Is it possible to have a one-line regex to detect whether the second & third portion is greater than 12 to better validate the date?
...
Let's say I have the following string:
this is a test for the sake of
testing. this is only a test. The end.
and I want to select this is a test and this is only a test. What in the world do I need to do?
The following Regex I tried yields a goofy result:
this(.*)test (I also wanted to capture what was between it)
returns thi...
Consider this regex: <(.*)>
Applied against this string:
<2356> <my pal ned> <!@%@>
Obviously, it will match the entire string because of the greedy *. The best solution would be to use a non-greedy quantifier, like *?. However, many languages and editors don't support these.
For simple cases like the above, I've gotten around t...
I am trying to get some elems with the classname "special".
I found the following script online, but it only returns an empty array.
Does anyone see what's wrong?
getElementsByClassName = function (node, classname){
var a = [],
re = new RegExp('\b' + classname + '\b'),
els = node.getElementsByTagName("*"),
l = els.length,
...
I'm trying to come up with a search/replace expression that will convert from Oracle style inserts with timestamp fields to insert statements for another database.
Basically, I want to convert strings like:
to_timestamp('13-SEP-09 12.00.00.000000000 PM','DD-MON-RR HH.MI.SS.FF AM')
to just:
'13-SEP-09 12.00.00.000000000 PM'
I've tr...
First, let me say this: I suck at regex and htaccess. I'm trying to make a rule that will properly parse url segments into variables. So far I have this:
RewriteRule ^([^/]+)/?$ index.php?query[]=$1 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?query[]=$1&query[]=$2 [QSA,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ index.php?query[]=$...