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
votes1
answer228
viewsRegular Expression - Split disregarding anything within parentheses
Can someone help me with a regular Java expression that separates the text by . (point) disregarding what is within the parentheses. For example: abacaxi.laranja.(pera.banana)limao.mamao You have to…
-
0
votes0
answers46
viewsregex for password
I would like to know how to make a regex that contains at least 8 digits being mandatory 1 digit with @!# 1 digit in capital letters and a digit with numerals from 0 to 9 tried something with the…
-
0
votes1
answer887
viewsRegular expression for monetary value
Watch the code in Java: String valor = 1.500,00; Pattern pattern = Pattern.compile("\\d+(\\.\\d{1,2})?"); Matcher matcher = pattern.matcher(valor); if (matcher.find()) { System.out.println("Valor…
-
0
votes1
answer84
viewsHow to adjust the regular expression in Java?
Look at the code: Pattern pattern = Pattern.compile("^\\d{1,3}(\\.\\d{3})*,\\d{2}$"); Matcher matcher = pattern.matcher(dadosCSV[position4]); And I took this regular expression already ready, it’s…
-
0
votes0
answers102
viewsCheck a regular expression with string in Java
I need to check if a particular digit recovered from a regular expression is equal to my input field digit, I am using the code below but can’t do the check: String digitoSenha = senha.substring(i,…
-
0
votes1
answer23
viewsConflict in Archive . Htacess
On htacess: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteRule ^blog/(.*)/$ blog/assuntos.php?disciplina=$1 RewriteRule…
-
0
votes1
answer223
viewsHow to identify files in the same name pattern, which are in a given directory, using Python?
I need to get the Python identify the files I need, and if you are one of them, open for processing: 1) All files are in the same directory, example: (r'C: Users Me Desktop Test File Test…
-
0
votes1
answer38
viewsRegular expression for match content between ('<' or "></") and ('>')
From text in XML format: <shipto attr="xpto"> <name>Nordmann</name> <address>Langgt 23</address> <city>4000 Stavanger</city> </shipto> I want to get…
-
0
votes1
answer415
viewsRegex in Zabbix 4.2 Web Scenario
How to recover values with regex from the return of a web scenario in Zabbix that calls an API. Web Scenario is for testing web pages and Apis in Zabbix. I already have the regular expression that…
-
0
votes1
answer50
viewsDo JSON regex excluding element
I have the Json below and need to pick up only the return token: { "token":…
-
0
votes1
answer171
viewsRegex angular ngModel
Hello, I have a problem with regex and angular. I have an input that uses ngModel, and I need to use a regex on it to prevent the user from initially entering a number, that is, the first input must…
-
0
votes1
answer56
viewsMATCH THIRD ELEMENT REGEX
How do I marry only the third </p> of that text? texto="<p>primeiro paragrafo.</p><h2>titulo 1</h2><p>segundo paragrafo.</p><h2>titulo…
-
0
votes1
answer133
viewsRegex to validate document - Javascript
I’m having some problems validating the document. Previously I asked this question here: Regex to validate national document number The problem I’m having is that the user is typing sequential or…
-
0
votes1
answer203
viewsREGEX ASP Classic Replace
How can I take a large text full of ulrs and upload them to links in ASP CLASSIC 3 using REGEX? I wanted to add this code. Get in the replace down there I have no idea... This Regex there, houses…
-
0
votes2
answers271
viewsAllow certain characters in an input text
I have the following expression:: (/[^\d]/g, '') I’m using this expression in a Javascript function so that a input type="text" accept only numbers. The problem is that I now need this function to…
-
0
votes1
answer55
viewsCatch all words between 2 characters
Text: var texto = "if(true) { {{palavra1}} + {{palavra2}}; }" The only characters I know will ever exist are {{ and }}. I did so, but this way I only get the first word: Regex r = new…
-
0
votes1
answer87
viewsRegular Expression for Secure Password
I need some help to be able to include in the regular expression I’m using to not allow spaces. The password must meet the following requirements: Have at least 1 number; At least 1 capital letter;…
-
0
votes1
answer62
viewsreturn specific content with regex - POSTGRESQL
I have the query below, where are captured the 3 largest memory consuming processes on the machine. I would like my select to display only the pid and the name of the process contained in {name: }…
-
0
votes2
answers1430
viewsInsert variable in regular expression
I need to change the name of the inputs after they are cloned. For example: order-recipient-name[0] would be order-recipient-name[1] and from there on. What I tried to: var current_counter =…
-
0
votes2
answers119
viewsContinue searching in the same Regex
I have the string below: Tel.: 324234 -- 2 123123 (22) I want to remove only the digits after "Tel.:", ie, 324234212312322, but using only 1 regex. I can get the numbers after "Tel:" but not all…
-
0
votes2
answers270
viewsTraverse string with PHP and return searched values
I am developing a script that is able to locate certain tags in a string and return all found. The pattern of tag will be: [exibebanner id="300"], being that within id="int" will always be an…
-
0
votes1
answer96
viewsRegular expression extractor error - JMETER
Good afternoon, everyone, I am unable to extract a data returned in the callback parameter in the GET HTTP - JMETER service. Could someone help? Goes below: JSON returned in call: { "wallets" : [ {…
-
0
votes1
answer78
viewsRule for . htaccess
I need the final url of my page accepted ., numbers, letters and underline however in the format I’ve been trying not to work, php returns me in the value of the parameter .php (???) Example, the…
-
0
votes2
answers182
viewsFormat "hour:minute" duration to ISO 8601 format
I’m trying to turn the string 05:25 for PT05M25S. I made it this far, change the : for M. But I couldn’t insert the rest that was missing. $date = "05:25"; $date = preg_replace('/[:\/]/', 'M',…
-
0
votes3
answers222
viewsre.error: bad escape c at position 0
I’m trying to make a search between arrays, and return the value when it is corresponding, and when it is not. import re array = ['brasil','argentina','chile','canada'] array2 =…
-
0
votes1
answer51
viewsI cannot capture regex from the end of the string with the Java replace method
I tried that code but the $ is not understood as the end of the string, but rather as a character to be captured, I did something wrong or it’s a bug? String s = "gabriel";…
-
0
votes0
answers121
viewsRegular expression keyword marking
Good morning! I have been two weeks evolving in the treatment of texts in Sqlserver (through CLR) with the use of regular expressions. Now my challenge is to "mark" names of municipalities so that…
-
0
votes1
answer56
viewsDjango Filter ignoring characters/symbols
Problem Users who register with the email in gmail can create multiple accounts just by changing the . (dot) place. For example: [email protected] and [email protected] direct to the…
-
0
votes2
answers39
viewsOracle - Regular expressions
Dear, I need to find out which users have the login pattern "E012345", that is, it begins with the letter E and proceeds with a string of numbers. I tried the query below on the did not roll: SELECT…
-
0
votes0
answers58
viewsFunction Improvement for Capitalize
This function returns me the first letter of each word in uppercase String(str).replace(/(^|\s)\S/g, (v) => { return v.toUpperCase() }) That is, this name Roberto if turn Roberto Monteiro but…
-
0
votes1
answer475
viewsRegex to accept accents in first letter and last letter of first and last name
I’m trying to create a regex in Javascript that accepts letters and accents in the first and last letter: var exp = /^((\b[A-zÀ-ú']{2,40}\b)\s*){2,}$/gm; var re = new RegExp(exp);…
-
0
votes1
answer42
viewsMy regex is not working
I made a regular expression for mobile, on the site https://regex101.com/ is working, but in my project no, follows below the example My Pattern in the code: telefone: [null, [Validators.required,…
-
0
votes0
answers161
viewsChange Regex to validate Java to Oracle sql email domain
I need help changing the Regex below to validate email domains on an ORACLE basis in accordance with RFC 5322, ensuring that the criteria below are met. Email domain rules to be respected: start by…
-
0
votes1
answer37
viewsRemove part of data entered by the user
I am developing a website for sending videos to teachers, for this, I made a form with the following fields: Considering I’m still learning PHP. I would like to know if it is possible to have the…
-
0
votes1
answer322
viewsExtract data from all rows of a file and create a dataframe
I have a file . txt with 2000 lines (Whatsapp chat) from where I need to extract to a pandas dataframe the date, time and sender of the message. I can do this with the function below: def…
-
0
votes1
answer32
viewsre.search also validates invalid emails
I’m having some problems with this email validation. Any text I put in it validates and accepts. What causes this? import re def email_validation(email): regex =…
-
0
votes1
answer47
views -
0
votes1
answer403
viewsHow to remove the last URL bar
Please, how can I remove the bar at the end of the URL. For example, I have these variables with the urls below, but I cannot remove the last bar: <?php $url1 =…
-
0
votes1
answer47
viewsProblem with regex in php
Hello, in my code I want to separate a string, having as separator a value that should be found via regular expression. Down with what I tried: $data =…
-
0
votes1
answer72
viewsValidate password with Regex
I’m trying to do an exercise where I need to validate a password, I tried this format but the conditional if seems to ignore the second condition. I could not find the problem, which may be? { let…
-
0
votes1
answer93
viewsRegex to pick up capitalized words in the middle of a sentence
my need is to pick up words that start with capital letters in the middle of a sentence. Example: "Facebook and Twitter are interesting. You can register anytime". In the example above, I need to…
-
0
votes1
answer76
viewsHow can I make regex recognize "partial results" in Javascript to mask an input?
I’m making a <input> with mask, formatting as user type. In this case, it is a CNPJ entry. A Regex to format the CNPJ would be /(\d{2})\.?(\d{3})\.?(\d{3})\/?(\d{4})-?(\d+)/g, but so it format…
-
0
votes1
answer58
viewsHow to Backreferencing with Regex in PHP?
Backreferencing to use the same text again in Pattern and leave another group in substitution only. It may have been confusing, but what I want is this. The String is this: $Str = ' <p>Os…
-
0
votes0
answers55
viewsStaff I am in need of assistance related to regex
I have a string in the following format. EX: 5 4 3 2. I set up a regex to take each position of this string and make a range of values (min and max), my doubt is how I can pass in my regex to this…
regexasked 3 years, 8 months ago Bruno Cordeiro 11 -
0
votes1
answer89
viewsFormatting a dictionary using regex, based on a large database
Let’s say I have a following sample from a more extensive database. 146.204.224.152 - feest6811 [21/Jun/2019:15:45:24 -0700] "POST /incentivize HTTP/1.1" 302 4622 197.109.77.178 - kertzmann3129…
-
0
votes2
answers84
viewsHow to pick a number in the middle of a string
I’m trying to get a number inside a url https://pokeapi.co/api/v2/ability/35/ This number may vary from 1 4 digits ago. I want to catch the number 35 but with my current regex I’m catching the 2 +…
-
0
votes1
answer46
viewsRegex python to find all values with Math in Brazilian currency
I need a regex to find all the monetary values of Brazil, I have done several researches and test but I could not reach a satisfactory result. 1.566.545,00 = True 154.565,00 = True 22.555,00 = True…
-
0
votes1
answer33
viewsNegative lookahead in php
What’s wrong with that regular expression? preg_match_all('/{{.*?(?!\|e)}}/',$content,$matches); In the text below it should not take {{Expression|e}} since I am denying the |e in the group (?!\|e)…
-
0
votes2
answers150
viewsRegex to remove the comma with a previous space
I have this string. Code: mrkk-918278 ,Title: Blouse-02 ,Price: R$ 60,50 ,Qty: 1 ,Code: mrkk-918277 ,Title: Blouse long sleeve ,Price: R$ 50,50 ,Qty: 1 ,Code: mrkk-918279 ,Title: Blouse-03 ,Price:…
-
0
votes0
answers23
viewsHow to convert this date string "2021-09-22T09:00:00" into standard format
I get that string in a request "2021-09-22T09:00:00" I need to turn her into this pattern with 22/09/2021 09:00 javascript Can someone help me? I need a regex to modify…