I’m trying to write a regular expression that checks if an email form field contains a free email address, with no luck. Essentially I need to check if the email contains: hotmail, yahoo, gmail etc in the email field. Answer regex would be sth like: you can add all the other domains you want… does it help you?
Tag: regex
regular expressions – same for all languages?
is the regexp the same between languages? for example. if i want to use it in javascript, would i have to search for regexp for javascript specifically. cause i got some cheat sheets. it just says regular expression. i wonder if i could use this on all languages, php, javascript and so on. Answer The basics are mostly the same
PHP preg_replace non-greedy trouble
I’ve been using the following site to test a PHP regex so I don’t have to constantly upload: http://www.spaweditor.com/scripts/regex/index.php I’m using the following regex: /(.*?).{3}/ on the …
Using regex to extract username from email address
My string of text looks like this: I need to get just the part before the @ and nothing else. The text is coming from a simple XML object if that matters any. The code I have looks like this: Sometimes the username might have numbers or an underscore before the @ symbol, which is where the regex stops it
PHP RegExp for nested Div tags
I need a regexp I can use with PHP’s preg_match_all() to match out content inside div-tags. The divs look like this: I’ve come up with this regexp so far which matches out all divs with id=”t[number]” The problem is when the content consists of more divs, nested divs like this: Any ideas on how I make my regexp work with
regexp with russian lang
I can’t solve my problem with regexp. Ok, when i type: everything is ok, except situation with Russian language. so, i try to re-type this reg-exp: but this not working, i know some idea, just write: but this is crazy 😀 please, give me simple variant Answer Try a Unicode range: Don’t forget the /u flag for Unicode. In your
How to split a string by multiple delimiters in PHP?
“something here ; and there, oh,that’s all!” I want to split it by ; and , so after processing should get: Answer
Regex for names
Just starting to explore the ‘wonders’ of regex. Being someone who learns from trial and error, I’m really struggling because my trials are throwing up a disproportionate amount of errors… My experiments are in PHP using ereg(). Anyway. I work with first and last names separately but for now using the same regex. So far I have: Any length string
Get PHP to stop replacing ‘.’ characters in $_GET or $_POST arrays?
If I pass PHP variables with . in their names via $_GET PHP auto-replaces them with _ characters. For example: <?php echo "url is ".$_SERVER['REQUEST_URI']."
“; echo “x.y is “.$_GET[‘x.y’]….