Skip to content
Advertisement

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

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

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

Advertisement