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
votes1
answer56
viewsTake value in Currency and remove "." and "," from an input field?
When the person enters the value in the input field with "." and "," I take this amount and leave only number, I am doing this using the "focusout" method. Because this way when the person type the…
-
-1
votes0
answers11
viewsRegex: How to remove line breaks after commas
Editing documents in ". txt" with texts in Notepad++, I notice that there are several snippets where there is a line break after a middle sentence comma. Ex: "John was moving to work,"line breaking"…
-
-1
votes0
answers23
viewsRegex to get a dd/MM/yyyy date by ignoring characters in the middle?
In this case I can have a string like String data = "20/dsauh'03*/2021"; My idea was to do something like: Pattern p = Pattern.compile("([0-9]{1,2}\\/[0-9]{1,2}\\/[0-9]{4})"); Matcher matcher =…
-
-1
votes1
answer46
viewsChange part of Pattern or regex javascript dynamically
I am making an ajax request that will return me an "X" page. My goal is to cut the page and manipulate the outerHTML to return only the <tr> which correspond to a specific Pattern/regex. var…
-
-1
votes1
answer131
viewsHow to use Regex to represent a more complex BNF?
I need to create a program with Regex that represents the following BNF’s: <list> ::= <element><list> | <element> <element> ::= <letter><digit>…
-
-1
votes1
answer40
viewsDisable button in React via validation
Hey, good night, fellas, what’s up? I’m having trouble with the validation of a button, it should be disabled if the validation did not pass, but as I am a student yet, I can’t tell for sure where I…
-
-1
votes2
answers49
viewsHow to remove ZIP code and country from a string
I’m using Javascript to manipulate some strings that comes from an API and I need to remove the zip code and country from one of these strings. Basically, I get the phrase like this: "R. Anderson…
-
-1
votes1
answer64
viewsOnly get snippets between brackets
In third-party software, a log record is generated with separate information through words that comes within a bracket. Example: [informação1] [informação2] [informação3] The problem is that the…
-
-1
votes1
answer82
viewsUse Regex to replace text
I need to display a text and replace a few words with a field of the type input. The idea is that it fills in this input the word that was hidden. It’s like a guessing game. So let’s assume I have…
-
-1
votes2
answers69
viewsCompare arrays or strings and return an array with all repeated elements (javascript)
I am using a function that returns a multidimensional array in which each index contains an array of prime factorization. This function, in turn, can accept a variable amount of arguments and…
-
-1
votes1
answer68
viewsWhat is the regex for all accented, whole words coming from a variable?
Starting from a variable var palavra = 'nascer' (for example) which regular expression takes all the words whole of a text? Including words that have an accent at the beginning or end.…
-
-1
votes0
answers34
viewsHow do you get regex to continue matching strings to a certain point?
I have a very large and confusing string that I’m picking up from a Crapping web. Here a piece: {"refineBy":"Filtro","feedbackYesLable":"H\\xc3\\xa1 alguma melhoria adicional que possamos fazer na…
-
-2
votes1
answer3816
viewsConcatenate strings in Javascript
I have the following function, which changes the numeric value of a string when found: var original = "Este aqui é o valor do cliente 000.000.00 01"; var original = str.match(/\d\d\d\.\d\d\d\.\d\d…
-
-2
votes2
answers182
viewsFinding strings in a log and other patterns
I’m trying to identify two strings in a log file: "Connected" and "Disconnected". But I’m not sure how to make it work. On my server I have stored several log files import os import time import re…
-
-2
votes3
answers4410
viewsHow to remove whitespace from a string with Regex in PHP?
What a PHP Regex would look like to eliminate more than one blank space from one string? For example, <img src=' smiley. gif'> I’d like you to stay <img src='smiley.gif'>.…
-
-2
votes1
answer31
viewsDoubt regex use information after "_"
I got the string: NeName = MGLUE_EPCVMH_UGW01 I need the first three letters after the first "_" Can you help me?
regexasked 6 years, 3 months ago Camila Suanine 1 -
-2
votes1
answer595
viewsJMETER - Regular Expression Extractor (regex)
Good afternoon, I have the following difficulty in JMETER: "presignedUrlRequest":…
-
-2
votes1
answer116
viewsI need a function to return true or false, depending on the amount of letters
boolean b = mascara.matches("\\D{0,4}"); I need a mask (like for example "GHO-1A23") is verified to contain only 4 letters. If you have 4 type only number and if you have less than 4 let type one…
-
-2
votes3
answers53
viewscleaning variables with preg_match()
How to use the function preg_match() to remove special characters and allow ., @ and accents? If it is not possible to do with this function, what other can I use to have the same result? Example:…
-
-2
votes1
answer51
viewsDelete hostname from a computer name via REGEX
NAMESERVER.DOMINIO.COM.BR From this format above I want to remove the NAMESERVER. via regex Staying only DOMINIO.COM.BR What would be the regular expression (REGEX) that varies this?…
regexasked 5 years, 8 months ago Thiago Oliveira 138 -
-2
votes1
answer94
viewsDifficulty writing a REGEX to validate URL
I’m having trouble creating a regular expression that validates the following URL: https://firebasestorage.googleapis.com/v0/b/nome-app/* *would be anything! Someone could give me a related surpote?…
-
-2
votes1
answer458
viewsJava field with numbers only
I’m doing a medical record for a hospital system test and I’d like to know how to validate the field CRM. It is a variable double, I want the field of Joptionpane accepted only numbers in CRM, I’ve…
-
-2
votes2
answers255
viewsRegular expressions to fix the format of a field as it is typed
I need help with 2 regular expressions in Javascript to validate two forms of data entry in an HTML input. 1) The first rule is for RNE following: RNE -> Fixo; A-Z, 0-9 -> tamanho 1; 0-9 ->…
-
-2
votes2
answers49
viewsSearch by full name - Reactjs
Hello, I’m trying to create a Search Component and when I search for example full name it return me the full name, but it only returns me the name example: [I type] Victor - He returns Victor, but…
-
-2
votes1
answer70
views -
-2
votes1
answer74
viewsPrint elements of a regex in sequence in python
Good afternoon guys, I am new in python and I am learning a few with this I would like to ask help from you, I have the following source code taken from a site: <div class='numerando'>1 -…
-
-2
votes1
answer84
viewsSearch for entered values in an input
I’m having trouble searching for the typed content in a input and I don’t know what’s wrong, this is the code: let g1=document.querySelector("#g") let p1=document.querySelector("#p") let arr =…
-
-2
votes2
answers787
viewsRegex that accepts only letters or letters and numbers
I’m trying to make a regex in Java that accepts: only letters; letters and numbers cannot have only numbers cannot have punctuation characters or special My difficulty is that I cannot make a regex…
-
-2
votes2
answers365
viewsHow to check for spaces before, in the middle and at the end of a string using Regex in C#?
I need to check with regex so that only letters and numbers are allowed. The other characters such as ,.-*&%$#@; among others cannot be accepted. In the regex below, I’m able to validate it! I’m…
-
-2
votes1
answer71
viewsReceive data from a url (m3u)
I have the following doubt: I have this URL: http://servidor.com8000/get.php?username=NOME&password=SENHA&type=m3u_plus When accessing it by the browser is made to download a file . m3u so…
-
-3
votes1
answer1273
viewsHow to validate a regular expression text not allowing everything in white space?
I need to validate a line from a text file, where I already have part of the expression , but I lack the part where from position X to position Y I have 30 characters that correspond to the type…
-
-3
votes1
answer106
viewsHow to recover data from a page
Good afternoon, could anyone help me on how I could recover data from that page with php? www.boline.com.br/test.php I know you need to use regular expressions to separate the data, but I don’t know…
-
-3
votes3
answers210
viewsHow would I look regex to handle this case?
I’m not able to separate words this way: In case I have CPFConsole, wanted to separate to cpf and console. The code I have separates so: ([A-Z][a-z]+)|([a-z]{0,})|([A-Z]{2,}) But that code separates…
-
-3
votes2
answers382
viewsExtract values from a javascript string
I have a page that presents information through AJAX. Each time I do a search, I have the value of the search and page on URL, as follows: /Material/Index?? palavraChave?? numPagina I can trace…
-
-3
votes1
answer781
viewsI cannot extract data from a site or file . txt
Hello, I would like to extract some data from a website or even an example notepad #EXTINF:-1 tvg-logo="https://i.imgur.com/rq9vXKI.jpg" group-title="FILMES",Mulher-Maravilha (2017)…
-
-3
votes2
answers275
viewsFind patterns within a String
I’m having trouble finding two patterns inside a java string, given a string. For example: String str =…
-
-3
votes2
answers621
viewsRemoving unnecessary question mark from a String
I have possible strings, where I would like to have a way to prevent unnecessary question marks and add if missing. However this function applies only at the end of the string. Follow the list below…
-
-3
votes2
answers319
viewsGet all the content I don’t want via Regex
Guys, I need to pull from a string, by Regex, all content that is not equal to CNPJ. Ex: Flap1 -> 123 - EMPRESA CICLANO101 30.589.587/0001-87 Line2 -> 4567 - FULANO LTDA28.819.917/0001-31…
-
-3
votes1
answer257
viewsHow to identify line end in Javascript / jQuery?
I have the following code: var cont1 = $('.stat_col:contains("Total de páginas impressas")').next(); var cont2 = $('.stat_col:contains("Total de páginas impressas em preto e branco")').next(); var…
-
-3
votes1
answer48
viewsHow to mount a regex for certain strings c#?
How could I mount a regex for a random string. For example if I were to take every word that was in this format in a string, 02ef6308-72da-491a-86b3-884a9e6bd959 I did so, but it did not work to get…
-
-3
votes2
answers79
viewsRegular expression for validating string and int in php
I need to validate this string. $scop = "ES-1236"; fixed value access key ES- dynamic 1236 the dynamic being only integer numbers. to validate I am creating a variable with the search $lets = "ES-";…
-
-3
votes1
answer90
viewsRemove all before the last occurrence of a - (dash) regex
This is so simple but I can’t find the answer! I would like to delete everything before the last occurrence of the "-" symbol in a sentence: I’m using a Pentaho step, Replace in String: Regex…
-
-3
votes1
answer71
viewsReturn "block" text with a keyword from a txt file
I have a text file inside it contains coupons follows example of a coupon: COTIA CENTRO ATACADAO S.A. PROF JOSE BARRETO ----------------------------------------------- CNPJ 00.000.000/0000-00 IE…
-
-4
votes1
answer76
viewsHow to use regular expressions?
I have a string with this value: Romania","PROXY_IP":"93.118.243.19","PROXY_LAST_UPDATE Indonesia","PROXY_IP":"117.102.88.121","PROXY_LAST_UPDATE…
-
-4
votes1
answer2182
viewsRegular expressions limit number
With regular expressions, such as limiting a minimum and maximum number of a string. I have a field where I can add 1 to 4 characters. But the numbers should be from 1 to 1000. This way you cannot…
-
-4
votes1
answer44
viewsRegex to catch only one occurrence of the right equerda
I’m looking for a Regex to pick up only the right IP address. I’ve tried some things but I can’t find out, that was the regex that seemed to work out best /((?[0-9]{1,3}\.){3}[0-9]{1,3})\s/g but she…
-
-4
votes0
answers16
viewsFull name regular expression
Hello, I would like a regex to validate full name in a form, but with some specific details: At least two words separated by a space character; Each word must have at least three characters; The…
-
-4
votes1
answer52
viewsFilter search block using regex
I’m trying to perform a filter using Regex to find the results that are within the option value. but I can’t take from the separate selects. when I use the expression : <option value="(.+?)"…
regexasked 3 years, 6 months ago Willian Lima 281 -
-4
votes0
answers29
viewsIn Bigquerym, how to find a text in a column based on another table and column
I made the example below with a blocklist table (where I have all the words that cannot appear in a product description). The product table, where I want to find these blocklist words in the product…
-
-5
votes2
answers489
viewsCan a regular expression become Assembly?
Regular expressions are known to be character patterns that associate character sequences in the text. Would it be possible to do the same for Assembly? Make there are expressions that would…