Questions tagged as 'regex'

4
answers

How to replace {vars} in a string?

I have a string string str = "Bem vindo {Usuario}. Agora são: {Horas}"; I want to replace {Usuario} with a name and {Horas} with the current time, how can I do this?     
asked by 19.12.2013 / 03:16
5
answers

Should I check dates with DateTime or regex?

I've seen two different ways to check if a date is valid. In a "modern" way, with DateTime : $date="2014-02-04"; $dt = DateTime::createFromFormat("Y-m-d", $date); return $dt !== false && !array_sum($dt->getLastErrors());...
asked by 04.02.2014 / 19:42
3
answers

How to do this regex?

I have some difficulties using REGEX, so I would like help separating the following text example: 1ª Temporada - Nome da temporada 01 - Nome do ep um 02 - Nome do ep dois 03 - Nome do ep três ... 2ª Temporada - Nome da temporada 01 - Nome do e...
asked by 09.04.2018 / 21:19
2
answers

How to get multiple groups in a Regex?

public string site = "http://www.tibia.com/community/?subtopic=worlds&world=Aurera"; private Regex nomedochar = new Regex("subtopic=characters&name=(?<player>.*?)\" >"); public string nomedochar2 = ""; public Thre...
asked by 20.04.2014 / 07:33
2
answers

"Variable system" with regular expressions

I have a file something like this: %usuario: 'Anônimo' Olá <b>%{usuario}</b> (This is just an example and is not the real case), but I think if I were to explain the real problem it would give me a lot more work to understand, s...
asked by 11.04.2014 / 16:46
2
answers

How do I work with REGEx on name validation?

I tried in several ways to develop a Regular Expression that validates: maximum length of 60 characters can not be number can not have accents, cedille and punctuation the first letter of the name uppercase and the lower case. Examp...
asked by 04.11.2014 / 18:37
4
answers

Removing numbers at the end of a string Regex C #

I have a string that contains the names of some records. Examples: string nome = "MARIA APARECIDA DE SOUZA MOURA 636598241"; string nome = "MARIA APARECIDA DE SOUZA MOURA 2018"; I would like to remove the numbers only when they are at th...
asked by 17.01.2018 / 14:05
3
answers

Retrieve groups from a regular expression in Perl

I'm running this regular expression to separate the digits of a version: ([\d]+)+ As you can see in this example , it works well enough to cover my needs. However, I have to add this to a Perl script, which is not my specialty. I run my...
asked by 03.05.2015 / 17:54
2
answers

Regular expression to reorder string

I have the result of a query with several joins , and in a row I have the concatenation of 2 groups. The line returns a string as: 1,4|a1,b4 . What I need is to regroup ID and Value as follows: array( 1 => a1 , 4 =>...
asked by 20.11.2015 / 01:49
4
answers

Remove duplicate names with regular expression

Suppose I have the following vector, with the names of presidents of the republic: presidentes <- c("da Fonseca, DeodoroDeodoro da Fonseca", "Peixoto, FlorianoFloriano Peixoto", "de Morais, PrudentePrudente de Morais", "Sales, CamposCampo...
asked by 30.08.2016 / 20:58