Questions tagged as 'regex'

1
answer

Python: The ^ is not transforming the character class of my regex to negative

I'm learning REGEXes by Automate the Boring Stuff w / Python. In one of the titles in Chapter 7, the book teaches about character classes. Until then, easy. I created character classes for vowels ( re.compile(r'[aeiouAEIOU]') ), for letter...
asked by 23.09.2017 / 22:53
1
answer

How to ignore escaped elements in a rule in regular expression?

I want to do with regex (regular expression), as for example (if it's javascript): var str = '[abc\[0123\]] [efg\[987\]h] [olá \[mundo\]!] [foo [baz]]'; str.match(/\[(.*?)\]/g);    Output: ["[abc[0123]", "[efg[987]h", "[olá [mundo]!", "[...
asked by 09.05.2016 / 18:32
2
answers

Regex to get sequence of equal numbers

I need to do a validation using regex, how do I validate if a string is coming with repeated numbers? for example "1111", "2222", "3333"     
asked by 22.10.2015 / 21:44
1
answer

How do I validate an e-mail field in Dart?

I created a simple project in Dart whose intention is to validate an email field when a button is clicked, showing an error message . However, the RegExp.hasMath function is always returning false . I do not know what could be wrong. B...
asked by 08.01.2014 / 02:25
1
answer

How to extract text in parentheses with regex in php

I have the text: Regular expressions (often abbreviated to "regex") are a declarative language used for correspondence. How do I get the content included between parentheses? I tried: $texto = "As expressões regulares (muitas vezes ab...
asked by 31.10.2016 / 17:42
3
answers

Command to replace characters recursively

I need a command that replaces a specific pattern in each line of a file as many times as necessary until the pattern is no longer found. For example, in a CSV file, the fields are separated by a semicolon ; . Null fields do not have a...
asked by 16.12.2013 / 16:25
2
answers

preg_split is not breaking the strings in the array

I'm not able to use the preg_split() function correctly. I'm trying to break a String in a array() via regex but it's not rolling. $string = "<:termo.9:><:termo.10:><:termo.11:>"; $res = preg_split("/(<:)...
asked by 30.09.2015 / 23:02
1
answer

9 Digit and Row Count via Regex Notepad ++

1st Doubt: How to convert a phonebook that is in the format: 1188888888 1288888888 3188888888 1187877766 To: 11988888888 12988888888 31988888888 11987877766 via notepad ++ regular expression? Or maybe if possible in PHP, as I h...
asked by 13.10.2015 / 20:56
1
answer

Second backslash in meta-characters when expression is enclosed in quotation marks

When using a pattern in quotation marks, it is necessary to add a second backslash ( \ ) in the metacharacters that have such a bar, as in this case, for example: /\d+/ -> "\d+" Code samples: var str = "Hello 123!"; // u...
asked by 26.07.2018 / 03:22
1
answer

replace all occurrences of a character in a string with javascript

I need to replace all occurrences of these 2 "_1" characters in a string with "_2", but Regex does not accept putting a variable there. var current_registration_number = 1; html = html.replace(/\_{current_registration_number}/g, '_'+next_regis...
asked by 27.07.2016 / 11:34