Questions tagged as 'regex'

5
answers

Regex take from one point to another within a text

I have the following text: From: .... blabla bla Message: blablabalab //linha em branco From: .... blabla bla Message: blablabalab //linha em Branco From: .... blabla bla Message: blablabalab How do I make my regex pick up where From...
asked by 16.03.2015 / 13:08
3
answers

Function that converts this string to json

I have string in the following format: "a=123 b="ABC" c="Olá Mundo!"" I need to create a function that transforms this string into this json: { a : 123, b : "ABC", c : "Olá Mundo!" } I think it has a bit of regular e...
asked by 10.06.2016 / 02:16
2
answers

Regex - Operator "." - Capture of meta character

Situation I'm doing a search with regex in a specific word inválido , but by preference I decided to use inv.lido . Which I knew I had in the test string, but did not return. Tests vr = var_dump...
asked by 20.08.2015 / 15:29
2
answers

Regular Expression R

I have a variable that indicates the year of elementary school that a student is attending, but this variable was not filled in uniquely. For example, the first year of elementary school because it is indicated as 1º ano , 1º Ano...
asked by 01.08.2017 / 15:54
4
answers

Which way can I use regular expression to capture only some attributes of links

I need basic example (s) of how I can compose a tiny script to just get the contents of the attribute href . I will simplify the explanation in two groups, they are: A and B In Group A we have the respective links started...
asked by 14.12.2017 / 06:44
1
answer

Regex to optimize code change using Notepad ++

Hello, someone can kindly help me create a regex expression for the pattern below. I have in my php code the following pattern: htmlspecialchars($str) I need to create an expression that replaces this with this: htmlspecialchars($st...
asked by 01.03.2018 / 20:15
2
answers

Regex in Javascript: grouping

As input from the user I am expecting pairs of numbers separated by commas: // se for um par só 1-2 // se for mais de um par 1-2,3-4,5-6 I expect something like this: [ [1, 2], [3, 4], [5, 6] ] I'm in doubt about getting this ou...
asked by 18.06.2014 / 18:40
3
answers

Regular expression to get the value after the comma

With the following expression (,) ([0-9] *) can get 25, but I would like to get only 25. decimal (10.25) In this case how do I disregard ,     
asked by 12.07.2014 / 16:17
5
answers

Return all CSS classes with Regular Expression

I need to return all classes found inside a CSS string, so that when the expression conflicts with: div.classe1{/*...*/} .classe2 div a{/*...*/} .classe3.classe4{/*...*/} .classe5{/*...*/} Return in an array (with or without the dots before...
asked by 24.02.2014 / 21:14
1
answer

How to detect if a string is a regex

Assuming I have the string: $regex = "/[^a-z_\-0-9]/i"; Is there anything native to php to test if it's a valid regex? If not, what would be the best way to test this?     
asked by 01.03.2018 / 22:31