Questions tagged as 'regex'

2
answers

AND operator in regex

I have the following date / time format: 25/01 / 2017a1111: 53: 37 And the following regex:    REGX_DATAHORA_DISTRIBUICAO = "(?<data>\d{1,2}\/\d{1,2}\/\d{4})|(?<hora>\d{1,2}:\d{1,2}:\d{1,2})" private OffsetDa...
asked by 09.10.2017 / 15:30
2
answers

Regular expression, removing values from HTML

I have an HTML that I need to retrieve the values from a set of <li> . This is part of HTML: <ul id="minhas-tags"> <li><em>Tagged: </em></li> <li><a href="/tags/tag1">tag1</a>,...
asked by 29.05.2015 / 02:52
1
answer

Different regex strategies to get the same result

I have the following input: Detalhamento de Serviços nº: 999-99999-9999 I need to get the number in a group, for this I would use: Detalhamento de Serviços nº: (\d+-\d+-\d+) But I can not trust whether or not there is the string nº:...
asked by 18.05.2018 / 20:05
2
answers

Regular expression that supports at least two of the four conditions

I'm writing a regular expression for validating a password. I wanted to know the easiest way to make a regular expression accept at least two of these conditions: Uppercase letters Lowercase letters Special Characters Numbers A...
asked by 27.07.2017 / 17:55
1
answer

Find all instances of a pattern in a text

I need to write a program that identifies a lowercase letter surrounded by three uppercase letters on each side. For example: "AEIoSDE" == "o" I wrote the code as follows: # coding: utf-8 letra = raw_input() for i in range(1, len(letr...
asked by 15.08.2014 / 18:15
2
answers

Picking characters uniquely in a multiple string

Hello, I need a help for a regular expression that satisfies some occurrences of a text file. In this case, I need a regular expression that finds occurrences where there are a minimum number of characters in a pattern. For example: I have...
asked by 18.03.2014 / 17:40
1
answer

Regular expression to clone a value in a field

I have the following values: PRO|00000001|GASOLINA ADITIVADA|0101001|27101259| I would like an expression that would change the values and look like this: PRO|00000001|GASOLINA ADITIVADA|00000001|27101259| I already have more or less a...
asked by 26.11.2018 / 17:10
1
answer

What is ~ in regular expression?

I'm with the code: function addhttp($url){ if(!preg_match('~^(http)s?://~i', $url)){ $url = 'http://'.$url; } return $url; } It will add HTTP if the URL you entered does not contain it, but what I'm in doubt is the...
asked by 20.02.2015 / 18:04
1
answer

Perl: Find a line in a txt by combining typed words?

Good afternoon, I have a notepad with several lines typed as for example: ★ Bayonet ★ Bayonet | Autotronic (Battle-Scarred) ★ Bayonet | Blue Steel (Minimal Wear) ★ Bayonet | Case Hardened (Battle-Scarred) ★ Bayonet | Case Hardened (Factory...
asked by 22.05.2017 / 21:38
3
answers

Validate field name - Jquery

I would like to know how do I validate a field name, to accept:    Letters (Uppercase and Lowercase)    Numbers    Spaces    Maximum 30 characters    There can be no double space    There can be no space at the beginning and at the end...
asked by 05.04.2017 / 02:08