Questions tagged as 'regex'

3
answers

What is the purpose of an empty parenthesis "()" in a regular expression?

Searching in Stackoverlow English on regular expressions, I came across a certain expression where it presents an empty group in it (an empty parenthesized expression). So: (DE)()([0-9]{1,12}) What is the purpose of this "empty group" (...
asked by 02.02.2016 / 15:32
8
answers

split / regex only on the first vertical bar "|"

I want to split the string into 2 parts (it will always be a array divide into two parts - or two elements) whenever a vertical bar | first case). For example: I have a string var string = "João|23anos"; I can give...
asked by 28.06.2017 / 19:45
2
answers

Check if parentheses have been closed

I need a Regex that checks whether the parentheses have been closed within the string . This is my example: /regex/.test("fdfdfdf(ddsd"); //retorna false, porque o parentese nao foi fechado;. /regex/.test("fdfedff(ffd)dd") //retorma true...
asked by 10.08.2014 / 21:36
2
answers

What is [QSA] for and similar in RewriteRule?

I have as an example the following RewriteRule ^(Home)?/?$ page/php/Home.php [NC,L] I know that NC is Non-Case(Não diferencia maiúsculas e minusculas) . L means that if a RewriteRule is true it stops checking....
asked by 08.10.2014 / 14:31
4
answers

I can not use boundary (\ b) to validate a word that begins with "@"

In the case of / \ b @ MYVAR \ b / i, I can not use boundary, See: link I need to validate a string that contains a @MYVAR (Example) word. Are there any restrictions on this character? What would be an alternative? I tested javascript an...
asked by 12.07.2017 / 23:23
3
answers

REGEX - Uppercase words in the middle of the sentence

Is there a regex / replace to make uppercase words in the middle of the sentence for lower case? (Yes, I could pass everything to Lower) but it has a however in it, the rule should be ignored if the word is after point (.). Example: Us...
asked by 19.01.2018 / 16:30
2
answers

Regular expression start, end

I have two regular expressions: $exp1 = '/^abc.*\_20150430.txt$/' $exp2 = '/^def.*\_20150430.txt$/' It should return true for files started by abc in the first and def in the second. In both expressions the string should end with _20...
asked by 30.04.2015 / 20:49
3
answers

Regex to select specific section

I need to identify the name, CPF and address information within contracts. The landlord's line is as follows:    LANDLORD: Jose Reinaldo Lellis de Andrade       LOCATOR: Isabel Cristina de Rezende Leme Ferreira Andrade I can select th...
asked by 20.05.2014 / 00:28
2
answers

What the expression "/ ^ (? :( ?: cats? | dog):)? /" does?

The question is about the following regular expression: /^(?:(?:gatos?|cachorro):)?/ In understanding I have the following: Start: ^ ( ) : this is a grouping, right? type (gato|cachorro|etc..) ? Why the first...
asked by 14.08.2017 / 22:35
3
answers

Clear Zip with JavaScript

How to clear the formatting of a ZIP code field in this format: 87.678-000 ? I need to remove the "." and the "-" and return only the numbers. I tried something like that, unfortunately it did not work out. var i = '^[0-9]+$'; var reg...
asked by 23.05.2014 / 18:47