Questions tagged as 'regex'

1
answer

Error undefined using replace ()

I'm trying to make a kind of people marking, I tried, but I did not succeed. Where is the error ?? var nome =["Ana", "João", "Maria", "José"]; var frase = "@[1] é casado com @[0], e @[2] é casada com @[3]."; var msg = frase.replace(/...
asked by 13.11.2015 / 00:01
3
answers

Problems with regular expressions (friendly url)

I'm having trouble reading a product's code from a friendly URL. With the regular expression that I put, it is accepting all the characters that are in front of the product code, that is, typing produto/9789/quantidade/5 it understands...
asked by 23.12.2014 / 13:46
3
answers

How to read file passing part of the name in Java

Example.: The name of my file would be 001nome.txt , this file will have a variable action on the name depending on the entity, ie an hour it can be 001nome.txt at another time it can be 999nome.txt . Doubt.: How...
asked by 28.02.2014 / 20:11
1
answer

Include tag in the first word of a string

I do not know much about regex, so I got this rule ready. $break_title = preg_replace('/(?<=\>)\b\w*\b|^\w*\b/', '<span>$0</span>', $title); return $break_title; The problem is that it does not recognize the cedilla, so th...
asked by 17.10.2014 / 21:52
2
answers

How to retrieve the number of characters via regular expression?

How to know the amount of repeated characters (example: Goi a b a = 2 letters a ) , consecutive characters (sequence of letters abc .. ) and consecutive numbers (example: 12345 .. ) within a word, using regular expression? Is this possi...
asked by 02.02.2015 / 17:37
2
answers

How to select all characters except some specific words using regex?

Good morning everyone, I would like to perform a string search for some specific character strings, but in the project we are working with we do not have access to any find function or similar, only to a regular expression-based substi...
asked by 11.02.2015 / 14:27
1
answer

Regular expression varies according to language?

Most languages have support for Regex (Regular Expressions) but, for example, JavaScript does not have Negative Lookhead ( (?< ), however .NET already Framework has practically all Regex functions. My question is:    Does the syn...
asked by 24.10.2015 / 20:09
3
answers

regex return false?

console.log(rule); // rule = max18 // rule = max120 // rule = max6 var pattMax = new RegExp('^(max).(\d{1,3})'); pattMax.test(rule); //false? if(pattMax.test(rule)){ console.log('é max seguido de 1 á 3 digitos'); }     
asked by 14.08.2016 / 05:50
4
answers

Separate text by space except within quotation marks

I'm trying to use a regex to separate space-separated texts, except for those within quotation marks, for example: Entrada: texto1 texto2 "texto3 texto4" texto5 Saida: Array("texto1", "texto2", "texto3 texto4", "texto5" ); Entrada: "texto0 t...
asked by 05.03.2018 / 18:50
3
answers

Error for unknown cause: "SyntaxError: invalid range in character class"

Situation: I have a page that contains a <iframe> of another, on this other page, I have a simple HTML element input : <input type="text" required="" pattern="[a-Z]{2,35}" tabindex="6" name="edtCidade" id="edtCidade"&g...
asked by 14.02.2014 / 16:40