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
-
1
votes2
answers1441
viewsFind regular expression record in mssql
I have a column that stores data in the following pattern #campo#=valor;#campo#=valor (and so on) ex: '#aaaa#=1111;#bbbbb#=2222;#cccc#=33333' However, they added ; within the value and I wanted to…
-
1
votes1
answer26
viewsValidation of a field in a REGEX form
Good morning, I have the following problem: I have a regex that validates the following situations: Not containing dots, spaces, accents and/or capital letters " [a-Z0-9]*$" I also wanted to include…
regexasked 6 years, 10 months ago Gustavo Pacheco 71 -
1
votes2
answers210
viewsFormat date with javascript
I’m developing an application in which I get the posts from a facebook page and need to format the post creation date that I get via json as follows: 2018-01-12T11:25:41+0000 What function should I…
-
1
votes1
answer118
viewsvalidating only .com.br regex
Staff was modifying a regex to validate only specific domains ending with yahoo.com.br, terra.com.br, bol.com.br, Hotmail.com.br. Then gmail.com, or provider.net.br would be invalid. So I did the…
-
1
votes0
answers41
viewsReplace, tag with attributes for merging documents
Hello I am creating a document that makes it possible to merge through tags, but, I will allow the user to add a separation within the tag, because I am doing this, in case of a customer…
-
1
votes1
answer3078
viewsHow to make a regex that accepts 8 or 9 digits with 2-digit DDD?
I have Pattern code: ^[1-9]{2}9?[0-9]{8}$, then I changed my mind to do with regex with mask and such... Example: (11) 1111-1111 - fixo válido (11) 11111-1111 - celular inválido (11) 91111-1111 -…
regexasked 6 years, 9 months ago Matheus Miranda 5,375 -
1
votes2
answers1112
viewsregex for url validation
People made this regex to validate URL: const std::regex pattern( "(?:(ftp|http[s]?:[//])?)?([w]{3}[.])?" "(.*[.](com|php|net|org|br|dk|at|us|tv|info|uk|co.uk|biz|se)?)?"…
-
1
votes1
answer68
viewsregex stop if the next charactere is another
Next: I have this text for example aluno['ACERTOS_ATV2_D2'] >5.5 & aluno['IDADE'] >24.5 & aluno['PROVA1_D2P'] <0.5 & aluno['ASSISTIU_AULA_1_D2'] <0.5 &…
regexasked 6 years, 10 months ago Geovani Ferreira 129 -
1
votes1
answer203
viewsRegex expression to find more than one occurrence in the same string
I am developing a template engine in PHP for learning issues because I am new to programming, and I would like a way to find more than one #include() in my view, because the one I have currently…
-
1
votes1
answer223
viewsValidate only numbers
I need to validate a string using Expressão Regular, it can only contain numbers. So I tried using the following expression /[0-9]/, but if the string contain a character and a number is considered…
-
1
votes1
answer633
viewsDirective to restrict regular expression typing in Angularjs
I wrote a directive to inhibit typing from specifying a regex. However there are two bugs in this solution: In the first example the input must allow only numbers or point-followed numbers [.], or…
-
1
votes1
answer102
viewsCapture data into space, regex
I am using this regular expression to capture data between asterisks: \*(.+)\* however it miscaptures when the text is filled with asterisks, for example in: oi pessoas *lindas* e pessoas *lindos*…
regexasked 6 years, 9 months ago Vinícius Lara 3,750 -
1
votes2
answers257
viewsSeparate the contents of a variable via Regex
In 2 variables I want to perform the following operations. In the 1st, var chat1, separate via regex 4 information: "To:", "How are you?", "B:" and "I’m fine, Thanks.", and be able to access them by…
-
1
votes5
answers1540
viewsRegex with Javascript - Taking only part of the string
Let’s say I have the following string: str = "http://www.google.com/joao.pedro?a=b"; Then I want to take just the Joao. using Javascript. I believe you can do with Regex somehow, someone can help me…
-
1
votes4
answers4237
viewsValidation for Phone type field
Personal someone would have some validation for telephone field type? Where the user cannot place dummy numbers in the field as number sequences (99999 8888 123456) or something like?…
-
1
votes1
answer250
viewsQuery to return middle text from a field
I have an appointment that returns some class names/disciplines, but I wanted you to bring me only the names of disciplines. Below follows the query result with the default…
-
1
votes2
answers1541
viewsRegex filter only values in real
I have the following regex: preg_match_all('/([0-9]+[\.]*[0-9]*[\,.]*[0-9]*)/', $string, $matches) If I get a string: 1 - João da Silva number 123456 with the value of R$:6,298.65 I have as return:…
-
1
votes1
answer163
viewsValidate a text with regex
I have the following code: final String msgRegex = "Produto [a-Z0-9À-ú, ]*"; final String msg = "Produto Soja"; if (msg.equals(msgRegex)) { System.out.println("Verdadeiro"); } else {…
-
1
votes1
answer72
viewsRegular expressions do not match the desired text snippet
I’m needing my program to capture an item from a given text, but it’s not doing that, on the contrary, it’s capturing everything that comes after that. Code I’m using, ex: String html =…
-
1
votes2
answers1646
viewsRegex to replace comma and spaces together
I have the text in the string below: string = "ele, joao gosta de maria, mas maria gosta de jose"; string = string.replace(/???/g,", "); Note that some words have more or less spaces between them,…
-
1
votes1
answer1137
viewsRegex for addresses (Streets, Avenues and Etc)
I need a regex that takes cases that have number in the address name and also normal address. The Number always ends after the address. Example: R 25 March 200. I need the address that would be: R…
-
1
votes2
answers152
viewsRegex to match in citation title
I’m trying to capture all citation titles in scientific articles, my regex is like this: (([A-ZÁÀÃÂÉÈÊÍÌÎÙÛÓÒÇ]{3,10}, ([A-Za-záàããâéèêêíìîúùóòõç- . ]. ( ){0,1}){1,3})(et al.){0,1}([Oo]rg.…
-
1
votes1
answer1079
viewsRemove duplicated string characters if not a graph
How to remove duplicate characters in a string if it is not a graph (rr, ss) using Regex? Ex: Oiiiii => Hi Aloooo => Alo Past => Past Car => Car If the rr or ss appear at the beginning…
-
1
votes1
answer104
viewsriding a Regex
I’m picking up a bit here with to assemble the Regex of a pattern I set up, which would be this: ALTERAC[AO,OES] [DE] CADASTRO[S] [-] SOCIAL What is between [ ] is what may vary. The doubt is that…
-
1
votes1
answer33
viewsHow to look for the same occurrence of a term independent of its position in a string?
I need to create a regular expression that finds the valuesrc=path-da-imagem in any position he is in. Example: With the expression<img\s(src=\S*)\s(.*?)\/> I can find results in: <img…
-
1
votes2
answers50
viewsAdd . html extension at the end of all links in multiple files (with Shell Script)
Hello. I have a lot of HTML files that have links in the following format: http://localhost:8080/tag:alguma_coisa and I need to add the extension .html to these links so that they stay like this:…
-
1
votes2
answers630
viewsRegex or Replace in Jquery
How to make a string change by adding new content? Example: <div><span id="number">1195555666<span><div> <script>var newNumber =…
-
1
votes1
answer319
viewsDo not accept duplicate values in a Regular Expression (Regex)
I have the following code: var str = "141271999 243306211 172266710 172266710 172266710"; var regex = /[0-9]{9}/g; //Encontrar 9 números entre 0-9 e retornar todos valores (g). var idsEncontrados =…
-
1
votes1
answer74
viewsRemove content between two files
I have two files. A file contains words like a dictionary and another file, contains logs. I would like the file containing the information (Dictionaries) to be removed from the Log file. Remove the…
-
1
votes0
answers73
viewsHow to color part of a text inside the input using REGEX or if you have any VUEJS plugin
My problem is the following I have an input with the text. Ex.: "I will add this new text". When the text is selected I change it to stay between keys. Ex.: "I will {{add}} this new text". SO FAR I…
-
1
votes1
answer191
viewsHow to search using regular expression in Delphi 7
In Delphi 7 when opening the search dialog box: CTRL+F and selecting the option: Regular Expressions would like to find everything that starts with the word Gpfield and ended with Isnull For…
-
1
votes1
answer48
viewsFind substring with REGEX
I am trying to turn all parts N_(...) into uppercase. I thought REGEX would be the most appropriate. It’s just too hard to even capture the N_(...) part and then turn it into capital letters I can…
-
1
votes1
answer206
viewsHow to select a text that does not have a certain term in the middle?
I am trying to select a part of an HTML code with Regex but I am not able to do the correct regular expression, someone could give a help? I need to select the groups of <li> separately, i.e.,…
-
1
votes2
answers93
viewsFilter code elements
Speak, guys.. Blz? I have a question here. I am developing a chat app on Youtube, and say I send or receive a message as follows: msg = "Oi, fulano. Acesse esse <a href="link">link</a> e…
-
1
votes2
answers87
viewsVariable to validate 'Login' field?
I’m having trouble creating a variable to validate my Login field. For example, in my 'First' and 'Last' fields, I have this variable: var padrao = /[^a-zà-ú]/gi; Valid in such a way: if 'Name' or…
-
1
votes1
answer90
viewsSuggestions from the IDE / how to do?
I have the following problem I have some text that will be inserted by the user and we will take as an example Inserted sentence: I wish I knew how to program better #today. I wanted a listview to…
-
1
votes1
answer564
viewsPrevent character typing if monetary value is incorrect in Delphi
My goal, using Delphi 10.1, is to compare the text typed in an Edit, at the time of typing a new character, if the text format after typing the key (which can be typed at the end, beginning or…
-
1
votes1
answer33
viewsReplace with the same searched word with Regexr including a new character
all right? I have a question. I used the expression ( d{2}. d{2}) as image attached to search the codes of this service list. I would like an aid so that the Replace occurred with the same searched…
-
1
votes3
answers840
viewsReplace word list in text
I always have a hard time with replace and sub. I know how they work, but with me it’s never right. I have a list of words and am trying to replace these words in a text: Text: Brazil, officially…
-
1
votes2
answers608
viewsRegex to validate currency, fractionated, accepting negatives
I will use in Delphi 10.1. I managed to reach the expression below, but for lack of knowledge and practice, I’m not getting to where I want. Regex: ^(^[\-]?[1-9]|0)(?:[0-9]{0,10}|0)(?:,\d{0,2})?$ I…
-
1
votes2
answers146
viewsFind a number after a specific word with grepl and regex {r}
Hello, I have a list of addresses and I’m trying to verify which ones have numbers and which don’t. However, I have some strings that end with number and I’m trying to create a regex to filter these…
-
1
votes1
answer305
viewsHow to extract a chunk of an xml using PHP?
How can I capture/return everything between tags <*:Body> and </*:Body> using PHP, so that it doesn’t matter how many lines there are before or after both tags? <?xml version="1.0"…
-
1
votes1
answer6307
viewsRemove accent via formula in Google Sheets
I need to remove diacritical signals (accentuation and cedilla) in the values of a column in Google Sheets. I know that it is possible and easier to solve this problem through an App Script…
-
1
votes2
answers114
viewsReplace numbers that are within a word
I want to remove numbers in the middle of letters, but I do not want to remove all numbers from the text, example: Vini12cius I want to turn into Vinicius, but without changing a possible CPF that…
-
1
votes1
answer239
viewsJSON Regular Expression and Deserialization Dictionary
I am developing a system that receives JSON from several layouts for a single channel and the Router class must identify which layout is by regular expression and perform the deserialization for the…
-
1
votes2
answers474
viewsRegular expression to filter the first paragraph between tags using PHP
I need to extract the first paragraph of an HTML code using Regular Expressions. The Goal: To get only the content highlighted in green: HTML code <div class="text"> <p><span…
-
1
votes3
answers1246
viewsRegular expression for 2 specific cases
I wanted two regexp to standardize a field. Follows the two values I need a regular expression. 1-167106651950 A number from 0 to 9, a mandatory dash and 12 more numbers from 0 to 9. SP4:01:342310…
-
1
votes0
answers51
viewsValidate String Regular Expression - Java
Hello, I would like to validate a String in java received from an INPUT. This validation would be to determine whether the user actually typed a valid email in the following pattern:…
-
1
votes1
answer43
viewsHow to use t (tabulation) on EOF outputs?
See the example below: cat << EOF alias\tVARIABLE = command EOF Execution output does not take regex into account \t.
-
1
votes2
answers53
viewsCapture data by default until last space
I am trying to make a Scrapping of a website, and would like to capture the value that follows the pattern below: Advogado: XXXXX Número do Processo: XXXXXX OutroCampo: XXXXX usually what separates…