Category "regex"

regular expression to copy line with some changes, mirror

I have a code in each html page that I want to duplicate, while add some changes: Example: <title>Any text (even if includes :.,</title> Output:

Regex to match word delimiters in multilingual text

I have a text box that a user can input any text in any language in and I need to split that text into words so that I could pass those words into hunspell spel

IDN (Domain) validation with regular expression

I want to check some domains with regular expression (regex). My old code was: /^([a-z0-9]+([-a-z0-9]*[a-z0-9]+)?.){0,}([a-z0-9]+([-a-z0-9]*[a-z0-9]+)?){1,63}(

Simple - using String#scan to extract an email address

I've got a string that contains: @from = "John Doe <[email protected]>" When I do: @from.scan('/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i') I

Validation code for IDN (Domain) with regex (regular expression)

I want to check domains with regex. My old code was: /^([a-z0-9]+([-a-z0-9]*[a-z0-9]+)?.){0,}([a-z0-9]+([-a-z0-9]*[a-z0-9]+)?){1,63}(.[a-z0-9]{2,7})+$/i It i

using (?s) Regex options in Visual Studio Code

I am used to writing regular expressions that support multiple options to specify case sensitivity, white space ignoring, meaning of . etc... In C#, these optio

How to match a string that starts and ends with the same letter?

How do I write a regular expression that consists of the characters {x,y} but must start and end with the same letter? For example: xyyyxyx yxyxyxy

Extract file that contains specific string on filename from ZIP using Python zipfile

I have a ZIP file and I need to extract all the files (normally one) that contain the string "test" in the filename. They are all xlsx files. I am using Python

c++11/regex - search for exact string, escape [duplicate]

Say you have a string which is provided by the user. It can contain any kind of character. Examples are: std::string s1{"hello world"); std::

Javascript regex for matching/extracting file extension

The following regex var patt1=/[0-9a-z]+$/i; extracts the file extension of strings such as filename-jpg filename#gif filename.png How to modify this re

Check whether a string matches a regex in JS

I want to use JavaScript (can be with jQuery) to do some client-side validation to check whether a string matches the regex: ^([a-z0-9]{5,})$ Ideally it woul

Pure regex solution to remove entire text after a certain part of text (in a plist file)

I've looked through all sorts of questions here, but couldn't find an answer to mine. I want to remove the entire text that follows a particular text part. Not

std::regex escape special characters for use in regex

I'm string to create a std::regex(__FILE__) as part of a unit test which checks some exception output that prints the file name. On Windows it fails with:

python regular expression - re.findall() in list

This is my list: lista=[u'REG_S_3_UMTS_0_0 (RNC)', u'REG_S_3_UMTS_0_1 (RNC)', u'REG_S_3_UMTS_0_2 (RNC)', u'REG_S_2_GSM_NORT_CBSP_bsc_0_0 (BSC)', u'REG_S_2_GSM_

extract word from string that have combination of letter and number in java?

this is my first question and sorry for my bad English I want to extract only word from String that have combination of letter and number and store it in array

how use regexp in flutter?

I want this format.see at photo. I use this code RegExp(r'^(?=.*[0-9])(?=\\S+$).{8,40}$').hasMatch(text). This code is ok for java but not for dart.I don't

Regex for two digits in any order

I need a regex that will match a string as long as it includes 2 or more digits. What I have: /(?=.*\d)(?=.*\d)/ and /\d{2,}/ The first one will match even

Split string into array of character strings

I need to split a String into an array of single character Strings. Eg, splitting "cat" would give the array "c", "a", "t"

Regular expression with variable number of groups?

Is it possible to create a regular expression with a variable number of groups? After running this for instance... Pattern p = Pattern.compile("ab([cd])*ef");

How to make a regex for textarea?

I have this code var message_regex = /^.{10,500}$/; I want the user to enter a minimum of 10 characters, But it doesn't matter how much words I enter my err