Questions tagged as 'regex'

2
answers

JavaScript regular expression does not work inside the form tag

function celular(){var celular=document.getElementById("celular").value; var ExpReg = /^[0-9]{11}$/; if(ExpReg.test(celular)){ alert("Sim passou no teste."); return true; } alert("Não passou no teste."); return false;} funciona:<input type="t...
asked by 12.10.2016 / 04:49
1
answer

Difficulty with Regex

I have the following content in a string :    | 1300 | 11349 | 03042016 | 10857,000 | 000 | 10857,000 | 444,470 | 10412,530 | 25,530 | 0,000 | 10387,000 |   | 1310 | 8 | 4657,000 | 000 | 4657,000 | 444,470 | 4212,530 | 53030 | 0.000 | 4...
asked by 30.05.2016 / 23:03
1
answer

Validate numbers only

I need to validate a string using Expressão Regular , it can only contain numbers. So I tried to use the following expression /[0-9]/ , but if the string contains a character and a number is considered valid. er =...
asked by 14.01.2018 / 19:26
2
answers

Add the class to the Regex result in preg_replace

I would like to add the class incision with regex and preg_replace echo preg_replace("/<li\>\s*<p\>[a-z]\)\s/", "/<li class=\"inciso\"\>\s*<p\>[a-z]\)\s/", $documento); This is the template for the lines in my docume...
asked by 05.05.2015 / 15:28
1
answer

preg_match () [function.preg-match]: No ending delimiter '^'

I get some help in putting the correct delimiters below: if (preg_match('/^[a-zA-Z0-9_-]+[/]{1}[a-zA-Z0-9_-]+$', $bloco)) { .... }     
asked by 20.03.2015 / 16:55
2
answers

Divide arguments with regex

I have difficulties with regex. I just need to split a string of entries. Input: "arg1 arg2 arg3 arg4"; Output: [arg1, arg2, arg3, arg4] Input: "arg1 'arg 2' arg3 arg4"; Output: [arg1, arg 2, arg3, arg4] My problem is in the second example...
asked by 12.02.2016 / 11:35
3
answers

preg_replace_callback does not work

I'm trying to change a variable with preg_replace_callback, but I'm not succeeding, does anyone know where the error is ?? $replacements = array( '[PEDIDO]' => $oID, '[NOME]' => $order->customer['name']...
asked by 02.08.2014 / 03:47
2
answers

turn text into link

I'm trying to transform the link of an image into the image within the tag, however I'm having difficulties when the image exists, the same I try to do with the link In case I use the code below $reply = preg_replace('#((http://|https://|//...
asked by 14.10.2014 / 00:50
1
answer

How to validate the price on Qt?

I would like to know how to validate the price on Qt, as follows: Examples accepted: 10,00 / 100,00 / 1.000,00 = true My code, (but is validating true: 10 / 100 ) bool ok; QLocale::setDefault(QLocale(Q...
asked by 17.03.2014 / 14:02
1
answer

Understanding RegEx test in MDN

Hello, searching for Regular Expression, I've got a link to MDN: [1]: link , but I looked, looked and did not understand because the example tested twice each variable, and because the last test returned false. The part of the given example, wh...
asked by 28.10.2018 / 02:38