Replace the question mark (?
) quantifier (“optional”) and add in a +
(“one or more”) after your character class:
@([^@ ]+)
More Related Contents:
- PHP validation/regex for URL
- PHP regular expressions: No ending delimiter ‘^’ found in
- Replace URLs in text with HTML links
- Remove non-utf8 characters from string
- How to remove accents and turn letters into “plain” ASCII characters? [duplicate]
- Regexp to add attribute in any xml tags
- PHP remove special character from string
- preg_replace: add number after backreference
- Retrieve all hashtags from a tweet in a PHP function
- How do I remove blank lines from text in PHP?
- How to use RegexIterator in PHP
- Regular expressions for a range of unicode points PHP
- How to write a recursive regex that matches nested parentheses?
- Split alphanumeric string between leading digits and trailing letters
- Allow only [a-z][A-Z][0-9] in string using PHP
- How to remove diacritics from text?
- non-breaking utf-8 0xc2a0 space and preg_replace strange behaviour
- What literal characters should be escaped in a regex?
- Warning: preg_replace(): Unknown modifier ‘g’
- Validating US phone number with php/regex
- php regex [b] to
- RegEx BackReference to Match Different Values
- RegExp in preg_match function returning browser error
- regular expression and forward slash
- Regex to match text between commas
- PHP Regex Get Text Between BBCode Tags
- Test if a string is regex
- Request exceeded the limit of 10 internal redirects
- RegEx – How To Insert String Before File Extension
- Detecting a url using preg_match? without http:// in the string