Most voted "regex" questions
Use this tag when the question refers to some resource, information, or problem relating exclusively to regular expressions. Regular expressions (usually abbreviated as "Regex", "regex" or "regexp") are a declarative language used for matching patterns within strings. When asking, also include a tag specifying the programming language or tool you are using to identify one of the different dialects.
Learn more…1,253 questions
Sort by count of
-
0
votes0
answers517
viewsNginx lock|redirect url files
I am creating a url shortener in my subdomain ex: (go.domain.com) to serve as an external reference, example: // a url de uma pagina (extensa)…
-
0
votes2
answers111
viewsJavascript regular expression does not work within 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…
-
0
votes1
answer367
viewsBreak lines with regex
I’m having a problem separating lines from several files txt. These files have a specific pattern but there are files that do not respect it. These are some of the 5000 files I’m trying to read:…
-
0
votes1
answer52
viewsProblem parsing regular expressions of a jTextArea
I am trying to analyze a text typed in a jTextArea, in the form of an algorithm in English. Initially I must recognize the main method, which is characterized by "beginning" and "end". The way I’m…
-
0
votes1
answer80
viewsphp regular expression
I’m trying to get a whole source code from a website. using CURL I used regular expression preg_match('/<html>(.*)<\/html>/i', $resultado, $codigo); echo $codigo = $codigo[1]; but it…
-
0
votes2
answers549
viewsRemoving replaceAll("[().- "]")
I’m using the openJDK1.7, I’m in need of help. String[] vetor = {"\"Jui.ce \"", "j-90.0", "Abobr.e-u"}; for(int = 0; i < vetor.length; i++) vetor[i].replaceAll("[()-.\"]", ""); The above code…
-
0
votes1
answer133
viewsRegular Expression REGEX HELP
I have an array on the server in Nodejs, I am going through html files and I need to return the value that is in the middle of the span tag using a regular expression as it would look ? { < span…
-
0
votes2
answers101
viewsRegularexpression allow greater than 0.00
False value: 0,00 -- false True value: 0,01 -- true 0,10 -- true 1,00 -- true 10,00 -- true 100,00 - true 1.000,00 -- true 10.000,00 -- true 100.000,00 --true 1.000.000,00 -- true 10.000.000,00 --…
-
0
votes1
answer313
viewsRegular expression in XML string
Hello, I’m using a PHP library to generate words with some parameters. The library is Phpword, when I upload a file (DOCX) it opens the Document.xml file inside the DOCX archive. Example: <?php…
-
0
votes2
answers113
viewsQuerie mongodb with regex
I’m trying to find the best way to make that wish on mongodb. I have this number 42999234180 and I have a table of prefixes ranging from 3 to 7 characters, I would like when searching for 4299234180…
-
0
votes1
answer1621
viewsregex java replace all
String url = "/users/{id}/books/{id_book}"; url = url.replaceAll("{\\w*}", "\\w*"); System.out.println("result url:" + url); Trying to replace with regex, and returns me the following error:…
-
0
votes1
answer148
viewsSelect an xml code snippet with regex
I need a hand with Regex again! I need to edit an xml file and insert after a certain information a sequence of instructions. But I can’t select all the information I need. I need to select the…
regexasked 7 years, 8 months ago Diego Sanches Garcia 13 -
0
votes0
answers37
viewsCharacter removal on Heroku server
I have the following code snippet for special character replacement public String removerAcentos(String str) { return Normalizer.normalize(str.replaceAll(" ", ""),…
-
0
votes1
answer115
viewssearch thousands of strings in thousands of files
I have the following problem: our system is parameterizable, and these parameters are in a table. But over the past 25 years, many programmers have tampered with the system and created and used…
-
0
votes3
answers4799
viewsHow to remove clasps in a regex?
I’m using a regex to remove some characters, but as one of them is [ brackets] and I’m having problems with regex replace(/[.!'@,><|://\\;&*()_+=]/g, "");. How would it be to remove that…
-
0
votes3
answers149
viewsHow to replace the extension but remain the title
I have a folder, in which covers several videos with equal names and different formats: https://sites.google.com/site/mplayerplugin/repositorio/monstros_sa_2.webm…
-
0
votes2
answers68
viewsFind term and capture text immediately or after space
I have some payment logs and these are the patterns that they created the file: Standard 1 Apelido -- isso é um espaço Fulano de Tal Standard 2 Apelido: Fulano de Tal Standard 3 Apelido: Fulano de…
-
0
votes2
answers724
viewsRegular expression to deny anything other than social reason
I’m trying to create a regular expression to remove everything that is not part of the social reason in a string, but I’m having a hard time not removing the symbols that are in the middle of it.…
-
0
votes1
answer278
viewsRedirect domain to a particular server folder via htaccess
I have two domains that point to my server, both to the public_html root folder. I need each domain to access a certain folder. Example: www.dominio1.com.br points to the folder /dominio_1…
-
0
votes2
answers756
viewsCreating a regex for vowels in C
I need to create a regex check if a word contains vowels, and after creating this check, I will cut out the vowel parts of this word, but I don’t know how to create a regex in C. I saw some codes so…
-
0
votes1
answer384
viewsFunction regex blank spaces SQL Server 2008
Hello, Within a specific table in my DB, I have certain fields that were registered by someone else (users), so some fields instead of having a single space ' ', has spaces of the most diverse…
-
0
votes0
answers78
viewsHow to determine if string is strictly decimal?
I would like that if the string has the comma (as we use in the Brazilian real to represent the decimal places), it returns true and if not, return false. Example: "1" = false; "1,00" = true; "10" =…
-
0
votes1
answer407
viewsFilter data from a string with regular expression
I have a variable that contains the full company name and CNPJ. I am using verificaCnpj = re.search("\d{2}.\d{3}.\d{3}/\d{4}-\d{2}", variavel) to locate the CNPJ (because there are other variables…
-
0
votes1
answer36
viewsDoubt with regular expression, data from a url
I have these Urls veiculos-sao-paulo-__4--6--.html veiculos-parana__4--6--.html veiculos-rio-de-janeiro-__4--6--.html With this regular expression: ^veiculos-([a-zA-Z-]+)__.+\.html? Caught the group…
-
0
votes1
answer57
viewsYou’re denying access to even normal characters
This command line is not letting my form access the database even with all normal characters someone who understands more than preg_match can help me?…
-
0
votes1
answer104
viewsMechanize with Nokogiri: trying to get information on Ivs
Hello! I am assembling a Crawler for product information, for this I am using mechanize and consequently Nokogiri, I have a URL (http://www.megamamute.com.br/brother%205652) that returns only one…
-
0
votes1
answer179
viewsRegex - remove element
I want to delete all characters except the last 3 letters that are uppercase. And another thing, like I do several regex together?
-
0
votes1
answer1054
viewsSeparate strings by semicolon but also store the semicolon
I am using the split to separate strings by space, enter and semicolon, but when it is the semicolon I need to store it in an array position as well. How to do this? Current Code: String[]…
-
0
votes1
answer51
viewsuse of regex on a switch
I’m trying to use regular expressions to validate a switch, but it occurs to me on the console that "day.match" is not a Function: function dayOfWeek(day){ var regex = /[1-7]/g;…
-
0
votes1
answer107
viewsOrder of evaluation of the alternatives in a regular expression is always taken into account?
I was here developing a function that took a logical string of characters, let’s call "query", this query represents simple expressions separated by ;, expressions can contain any of these…
regexasked 7 years, 3 months ago LeonanCarvalho 3,527 -
0
votes0
answers140
viewsQuery with special characters in an Observablecollection
I created a search method that receives a text, and searches that text in a ObservableCollection pre-filled. private void btn_Pesquisar_Click(object sender, RoutedEventArgs e) {…
-
0
votes1
answer34
viewsRegular expression to remove images containing a height range in inline style
How could I improve this regular expression to remove images that range from 29 to 45: [0-9]{29, 45}? my expression:…
-
0
votes1
answer167
viewsFind more than one standard re python?
I’m trying to rename files using regex in python, with only one standard works: def new_string(pattern): text = pattern.group().lower() renturn "{}_{}".format(text[0], text[1]) regex =…
-
0
votes1
answer73
viewsREGEX JAVA Find a chunk throughout the document
I am trying to develop a Regex expression in the JAVA language to find and validate the existence of a small sequence of characters within a . txt. Exp: Validate the existence of the sequence…
-
0
votes1
answer371
viewsHow to set up a regex?
I’m assembling a bot for rocketchat to turn machines on and off in google cloud, I need to assemble a regex that covers the words Turnon and turnoff. Someone could help me with this?
-
0
votes1
answer75
viewsSeveral filters in a regex
I need to validate a field input which may have the following formats: `D-1` ou `D-10` ou `D-1_1` ou `D-10_1` ou `D-1A` ou `D-10A` Letters and numbers may vary, but they will always have one of…
-
0
votes1
answer605
viewsPostgresql regular expressions
Come on, guys, I need some help I’m trying to make a Rigger in postgresql that checks whether the format of a new data to be inserted into a table is in a certain format, in this case the phone…
-
0
votes1
answer752
viewsExtract last numbers with Regex
I have these two examples of strings: /news/uk-news/commuter-who-extraordinary-row-woman-12345 /news/weird/dude-who-killed-14-extraordinary-98765.amp I just want to get the latest numbers, 12345 and…
-
0
votes1
answer156
viewsAutocomplete with two types of data
How do I load two types of data in the same input that is receiving an autocomplete (Eayautocomplete plugin). I would like to appear the options by cnpj number and company social reason. No regular…
-
0
votes1
answer73
viewsChoose how many lines you want to show in the output
I am trying to put a flag -n to be able to show in the output the number of lines desired by the user, having so far only been able to show the line number beside case "$1" in ## definir o…
-
0
votes0
answers87
viewsRegex to check a string
I’m having trouble creating a regex, I’d like him to identify SP or sp or São paulo, then any other words and again check if you have, outro or Minas gerais(other states), in this sequence, example…
-
0
votes1
answer314
viewsHow to extract information via regular expression?
I have the following string: adapter-UDP02_sistem10_a.log How to extract the stretch UDP02 via regular expression? The logic being: capture everything after the - (hyphen) and before the first _…
regexasked 6 years, 10 months ago Fábio Jânio 3,407 -
0
votes0
answers105
viewsHow do I scan a string and bring different parts of it?
Using REGEX it is possible to "concatenate" masks to bring different parts of the same string? How do I scan a string and bring different parts of it? I have a text field with the following…
-
0
votes0
answers143
viewsRegular Expression in PHP (Remove a specific TAG among other tags)
I need to learn how to remove the tag '</div>' among the Tags '</blockquote> </div> </figure>' in PHP. Reinforcing, only in this condition that the GAR </div> should be…
-
0
votes1
answer87
viewsRegex
Good morning. I have an XML that contains a node as follows: <endnum>76 AP 10 404</endnum> <endnum>404</endnum> It turns out that this value should only be integer, as in the…
-
0
votes1
answer247
viewsREGEX to get information inside a string
I’m studying PHP OO and part of my study is building a Class that works on a template engine. I converted the file to a string with file_get_contents and now I want to take a part of this string to…
-
0
votes0
answers278
viewsRegex to search for words
How to create a REGEX to search for a word in a string taking into account accented and/or upper case words. A search similar to Ctrl+f
regexasked 6 years, 9 months ago Josivan Sousa 61 -
0
votes1
answer3741
viewsRegex Phone validation
I am currently using a regular expression to validate phones in the following format: (xx) xxxxx-xxxx It only accepts numbers that have this exact shape. I wonder how to modify the expression to…
-
0
votes0
answers171
viewsRegular expression to remove certain content
I have some texts that are in HTML, which perhaps has specific style attributes, I would like to make a method that removes these tags and their content, because they are titles... and specific…
-
0
votes2
answers1203
viewsRegex to make full-name first letter uppercase, whether or not with a special character
I have the following variable in the Angular JS $Scope, with an Arrow Function: $scope.cad.nome.toLowerCase().replace(/\b\w/g, l => l.toUpperCase()); Which I need to format your content, which is…