Questions tagged as 'regex'

4
answers

Regular expression to validate a field that accepts CPF or CNPJ

I have <input> in the form that should accept CPF or CNPJ . In the back-end in PHP the value to save either in the " cpf " field or in the " cnpj " field of a table in the database. I'm using AngularJS and I need a regular...
asked by 30.03.2014 / 06:56
5
answers

Regular expression to detect the credit card flag

I need the Regex to detect when the credit card banner is Hipercard, Aura and Elo. I already have regexes for Amex, Martercard, Diners Club, Visa, Discover and JCB: Visa: ^4[0-9]{12}(?:[0-9]{3}) Mastercard: ^5[1-5][0-9]{14} Amex: ^3[47][0-9...
asked by 01.02.2014 / 12:18
5
answers

How to validate with regex a string containing only letters, blanks and letters with an accent?

I want to validate an input text for full name in order to accept only letters, blanks and accented letters.    Valid Formats:   Leandro Moreira   leandro moreira   Kézia Maria   kezia maria   Cabaço da silva   Cabaço da Silva This...
asked by 14.05.2014 / 00:05
6
answers

Regular expression for e-mail validation

I'm trying to create a regular expression to validate any email, I wrote the expression below, but it is not working as expected: var parse_email = /^[a-z0-9.][email protected][a-z0-9]+\.[a-z]+\.([a-z]+)?$/i; What I expected from each section: [a-...
asked by 28.12.2013 / 20:00
4
answers

Validate first and last name with regular expression

I need to create a regular expression that validates whether the format of the user's first and last name is valid, for example: Maria Silva | true Maria Silva | false Maria silva | false maria Silva | false MariaSilva | false In other wo...
asked by 03.10.2017 / 20:20
4
answers

What does the regular expression "/ (? = (?: ...) * $) /"?

I just needed a solution to put points to separate numbers from three to three, backwards. For example: 1000 => 1.000 100000 => 100.000 10000000 => 1.000.000 In a response I found in Stackoverflow English , the last solution wa...
asked by 06.02.2017 / 12:01
3
answers

What is a greedy Regular Expression?

What is a Expressão Regular Gulosa ? What sets it apart from Expressão Regular Não-Gulosa ? Expressões regulares Gulosas consume more resource than Não-Gulosas ?
asked by 23.10.2015 / 12:49
1
answer

How does the "positive lookahead" (? = X) combined with the "positive lookbehind" (? = X) work?

After answering this question , and though manage to realize what is occurring in the regular expression of my answer, I was curious to know how the ((?<=;)|(?=;)) excerpt works. I read in this answer what each one does, and al...
asked by 16.10.2017 / 12:21
2
answers

What is a regular expression?

In many codes I see functions with a set of special characters that seem to have a function of their own. I see this in almost every language, so what is it anyway, a class, a library, or what then? Although there is a response in this qu...
asked by 20.02.2017 / 08:34
4
answers

How to get only the numbers of a string in Javascript?

I would like to know if there are functions that return only the numeric values of a string, if any, which is the simplest and most efficient way to implement? Example: apenasNumeros("5tr1ng"); Result:    51     
asked by 01.02.2014 / 13:17