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
votes2
answers73
viewsUsing Regex to give match quotes after delimiter
I need to use regex to give match in all double quotes occurrences after the two dots (:) in a JSON output. JSON: { "data": [ { "ServerName": "server.name", "Installed": 204, "Downloaded": 60,…
-
0
votes2
answers141
viewsHow to group substrings in condition and return them with BASH_REMATCH
I need to split a file-named string, in 5 parts, as an example below: #!/usr/bin/env bash str="python-zope-proxy-4.3.5-1-x86_64.chi.zst" pkg_re='(.+)-[^-]+-[0-9]+-([^.]+)\.chi.zst*' [[ $str =~…
-
0
votes1
answer108
viewsBreaking text with regular expression in Javascript
I’m trying to break a text using regular expression with Javascript, but I’m not getting the expected result. I have the following string: var texto = "texto inicial <div>Texto dentro da…
-
0
votes1
answer113
viewsHow to select/find opening and closing quotes in a string using regex?
Passed a string I must apply a regex that selects the opening and closing quotes, ignoring any occurrence of quotation marks in the internal scope of the string. See some examples: "Deve selecionar…
-
0
votes2
answers57
viewsRegex passes the test site but the code does not work
I created a regex ( d{1,}(. d{2})?$ ) that was to allow values in the format 21 or 21.30. I tested the regex on a website and it worked: I’m making the following code: const regexMoneyFormat =…
-
0
votes1
answer53
views -
0
votes1
answer154
viewsHow to hyphenate between string characters
Separating the characters of a string with a Python hyphen works perfectly this way: import re regex = r"\B(?=(.{1}))" test_str = "Pêssego" subst = "-" result = re.sub(regex, subst, test_str, 0) if…
-
0
votes1
answer100
viewsHow to create specific validations using Regex
I have the following data 30140083|MG 13407061|07309482697|12/01/86|EMILLY L V GOMES|4984012024889591|10/2018|557 3283005|165055881|07309480805|11/18/16|AILTON B TEGON|5549320054855241|6/2018|177…
-
0
votes2
answers85
viewsJavascript regex schedules
I’m doing a regular expression to check the following pattern: 2M1-2M2-6M1-6M2 Physics 2 Timetable (separated by -) + space + name of matter. Where the first digit means (2-Monday | 3-Tuesday |…
-
0
votes0
answers30
viewsFilter wordpress post using REGEXP for posts other than A to Z
I would like to know how I can perform a complete filtering process of wordpress posts using regular expressions, so that only show any or all posts that do not have as initial character from A to…
-
0
votes0
answers14
viewsError inserting special characters in gmailr::gm_subject()
I prepared a script to automate the sending of emails using the gmailr. However, when I put some special character in the Email Subject, it sends only a sequence of codes instead. Example: Script:…
-
0
votes0
answers35
viewsProblem with Regex and Java
my problem is to solve is to remove a substring from a string but ignoring accents, spaces and any special characters. I will paste the test scenarios that makes it easier to understand the problem.…
-
0
votes0
answers18
viewsRegex for AFD files
Good morning I have a Txt file with a series of lines that divide the point beats that we have here in the company. Each line of this can contain the hit information, such as the time and…
-
0
votes0
answers40
viewsComparing names from two different lists - ideas on ways to compare
I’m trying to compare company names between two different lists. The case is as follows: both lists may contain different names for the same company, for example: Nome1: Escalar Nome2: Escalar Group…
-
0
votes1
answer43
viewsFind string fields with python regular expressions
I am logging into a device and giving an ifconfig on it, the generated information is: ['ifconfig'] ['>ifconfig'] ['br0 Link encap', 'Ethernet HWaddr A4:33:D7:53:5E:08 '] [' inet addr',…
-
-1
votes2
answers1016
viewsRegex | Take group split
This tag repeats by changing the content and I would like to know if there is a way to get each content separately TextBox TXTTESTE = new TextBox(); TextBox TXTTESTEDOIS = new TextBox(); TextBox…
-
-1
votes2
answers304
viewsPhp preg_replace replace src image
I would like to know how to add the site url in front of the existing src of all images of an example string: <img src="images/teste.jpg" border="0" width="486" height="370" style="margin: 5px;…
-
-1
votes1
answer331
viewsValidation of Data Regex
Good Morning ... I would like to know how I can validate a date ! Where the Final Date Cannot be less than the Initial Date (dataFinal < stardate) with regex !
-
-1
votes1
answer259
viewsHow to get specific string text with Regex?
I’m trying to manipulate the return of a string where I always need to get the block Where do select the problem is that my method always returns different strings. For example: SELECT.....…
-
-1
votes1
answer709
viewsExtract existing value between two regular expression tags
How to check from a regular expression whether there is a certain value between two strings, for example, tags <code> and </code>? I want, for example, to know if there is between the…
-
-1
votes2
answers68
viewsSimplify the use of multiple Places all
I got the following var res; $(window).load(function(){ $.get("http://ipinfo.io", function (response) { res = JSON.stringify(response, null, 4); res = res.replace(/:/g, ''); res = res.replace(/\"/g,…
-
-1
votes2
answers85
viewsQuantify new line ( n) in regex
Is there any way to quantify many paragraphs without being literally to use with PHP? \d{54}, for example represents 54 digits, but you can’t use \n{54}. I want in one regex take a dice that is 54…
regexasked 7 years, 1 month ago Antonio Oliveira 45 -
-1
votes1
answer42
viewsRegex -- String validation
Good evening, you guys, I’m having trouble forming a Regex that only validates the presence of minute letters and numbers. If anyone could help, I’d really appreciate it! Thank you
regexasked 6 years, 11 months ago Gustavo Pacheco 71 -
-1
votes4
answers747
viewsRegex in Python to find several possible names
I need to find the name of the judge in a file of labor process, but first I need to know if he is Judge(a), Rapporteur(a), Judge(a) Rapporteur(a) or Judge(a). I’m using the following Regex: f_regex…
-
-1
votes1
answer71
viewsTreat CNPJ’s list with regular expression
I have a list of CNPJ’s, I would like to take this list and add simple quotes and separate each of them with comma, doing this with regular expression. Ex. My list: 32132132132 32132132132…
regexasked 6 years, 8 months ago Leonardo Oliveira 3 -
-1
votes1
answer584
viewsCopy code snippet, modify and paste into another Div
I am structuring an experimental system where when clicking a button it copies what is selected (in this case a snippet in html) as the below: <section> <h1> titulo </h1>…
-
-1
votes1
answer88
viewsREGEX - How do I search for expressions that DO NOT contain a specific part?
I’m working with PL/SQL. Through REGEX, how do I find all expressions that are different from: <cod_orgao_destino>9577</cod_orgao_destino> Thank you!…
-
-1
votes1
answer56
viewsHow to apply regex , using C# in a pdf file?
private static string BuscaComparacao (string url) { Regex r =new Regex("\S+\D{3}[.]\D{3}\S+\D)"; var result = r.Matches(url); return result[0].ToString(); } the code does not find the data I sent…
-
-1
votes1
answer246
viewsRegular Expression | Picking part of content between 2 markers
I have no knowledge of regular expression, so I do not know if it is possible to carry out the solution of my problem. Throughout the HTML code of a site, it always has a code similar to this.…
-
-1
votes1
answer68
viewsCreate a regular expression to validate at least three characters (accepting spaces)
I’m using this in my code : <input required pattern="[a-zA-Z0-9]{3, }" title="Por favor, preencha pelo menos 3 caracteres entre letras e números." type="text" class="form-control" id="pesquisa"…
-
-1
votes1
answer60
viewsRegex backreference within group with OR
I am trying to reference a value within an "OR". Example, I have the text inside the file: CREATE TABLE ABC; ALTER TABLE ABC; I need the ABC (table name) of ALTER always be equal to CREATE, I have…
regexasked 5 years, 11 months ago Francisco Proença 84 -
-1
votes1
answer120
viewsI need to find regex to parse a variable
I need to analyze a C code using regex and I’m having trouble knowing if a variable is receiving a float or integer value. Ex: valor_01 = ( 5 * 3 ) / 2.5 + ( 4 % 3 ) ^ 4 ; valor_01 can be any…
-
-1
votes1
answer97
viewsCorrect regex in C++ returning 0
Expensive, I created a regular expression for MIPS instructions. It was a lot of work, but I got it. At least regex. works, but C++ doesn’t. Here’s the code with the expression some string examples…
-
-1
votes2
answers301
viewsValidation of regex URL
Good afternoon. I need to do a URL validation using javascript. I have the following regex: /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@@!\$&'\ (\)\*\+,;=.]+$/gm It turns out that…
-
-1
votes1
answer154
viewsHow to turn content from a file into an array in PHP
I have a file that has a array with the translations of a website. The contents of the file are similar to this: var textHome = { "home": { "btn_contact": { "pt": "contato", "en": "contact", },…
php javascript array regex file-get-contentsasked 5 years, 2 months ago Thiago da Victória Nunes 59 -
-1
votes1
answer129
viewsRegex to return the line
Knowing that \n is a line break, have any do the reverse? I am using the Sublime as editor and my text is like this: 1, 2, 3, Turn into: 1,2,3, Is there any regex or other means to do so?…
-
-1
votes1
answer673
viewsHow do I scroll through the Select list
<script> function check(){ var verificaInput = document.querySelector("#cidade").value; var reg = /^[0-9]{4}$/; console.log(reg.exec(verificaInput)) console.log(reg.test(verificaInput)) }…
-
-1
votes1
answer80
viewsFunction to check combobox and select an appropriate Regexp
How can I insert a function that checks the optionlist and after that checks the regexp of the banks below? There are 8 digits allowed in regexp to check the account in each bank, I do not know how…
-
-1
votes1
answer572
viewsWhich Regexp to validate Portuguese registrations
I wonder what the Regular Expression validating registrations of Portugal. whereas there are such registrations in Portugal AA-00-00 00-00-AA 00-AA-00 AA-00-AA what Regexp code I have to use to…
regexasked 4 years, 10 months ago João Pimentel Ferreira 135 -
-1
votes1
answer325
viewsIgnore accent when using search menu (input)
I created a input search and a list (side menu) below, when I do the search is ok, but I’m in trouble when any <li> has voice with accentuation. How could I implement a regular expression to…
-
-1
votes1
answer423
viewsRemove white space in select (SQL)
I wonder if you have any way to remove the blank space of the records returned in select. for example I have the NEIGHBORHOOD table with the records Bela Vista 'Amazonas' ' Gravel' but when I do…
-
-1
votes1
answer62
viewsReplace "Apostrophe" key when typed in mobile input
I am having a problem that I am not knowing the resolution when the system in question is accessed on mobile devices only. I have a TEXTAREA field so that users can write their data and consequently…
-
-1
votes1
answer135
viewsRegex to find a dash not followed by letters
I have the following situation: const a = " s - al"; console.log(a.match(/^-|(?<![a-zA-Z0-9])-/)) This current regex returns a match in "-", but it should not, because there is a letter preceded…
-
-1
votes2
answers446
viewsTake a string snippet between () and change it in Javascript
I have a text string in the following format: Size 35 (5 units) I need to take the numbers inside the parentheses, run a function (which is already ready) and return a new number in place. The…
-
-1
votes1
answer119
viewsHow to get the table name of the first select Oracle?
I have the following oracle query: SELECT * FROM TABELA_PESSOA A WHERE A.CPF IN (SELECT B.CPF FROM TABELA_CONTA B WHERE B.CPF = A.CPF) I want to get the table name of the first select which is the:…
-
-1
votes1
answer191
viewsSwap the letters of the beginning of an email with another character
I’m trying to replace letters with asterisks of an email using the preg_replace() php, but php takes all the letters in the email, but I just want to put the asterisks in the first letters. example:…
-
-1
votes1
answer291
viewsHow to replace two or more hyphens or spaces with just one hyphen
I’m building a blog and I need a script to get the title of the post and generate a link (without accents and spaces), as you write. I rode this one below, but I could not ignore 2 hyphens in a row,…
-
-1
votes3
answers90
views(C#) How can I replace a specific character "x" with "y" in a String?
To want to make a function that can replace a value in character( "@" ) with a value "A" inside the string. Assuming the input is "@@bbcc@@", then the function returns "AAbbccAA" .…
-
-1
votes1
answer410
viewsJavascript - Regular expression for formatting values in real
Hello, I am studying regular expressions and trying to make a function to format values. The idea is to receive a value and return it formatted. Example: 400.00 --> 400,00 150000.00 -->…
-
-1
votes1
answer219
viewsSeparate list of names according to regex notes
How to resolve this with regex? The archive assets/grades.txt contains a list of people - one per line - containing your notes. Create a regex to generate a list of students who received grade B.…