Skip to content
Advertisement

How to ignore strings that start with certain pattern using regular expression in python?

Accept and return @something but reject first@last.

JavaScript

The above regexp will accept @something (starts with letter, ends with letter or number, may have underscore in middle, atleast 2 characters long) and returns the part after the @ symbol.

I do not want to return strings which contain some letters or number A-Z0-9 before the @ symbol.

Spaces, new lines, special characters, etc before @ is allowed.

CODE:

JavaScript

Advertisement

Answer

Use

JavaScript

See regex proof.

EXPLANATION

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement