Category "regex"

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

Removing leading, trailing and multiple spaces within a string

I would like to remove all leading and trailing spaces. As well as replace multiple spaces with a single space within a string, so that all words in a string ar

How to split a string of author names by comma into a data frame and generate an edgelist to plot a network?

I have a long list of publications saved as a single column in a data frame. I'd like to generate a network of a short subset of co-authors that have contribute

Regex to find or extract strings between the "<>" angle brackets

In the following string, Jason <[email protected]> how can I extract the part inside the angle brackets? I tried <\w> and it didn't work. Ideas

How to split a vcard file into separate contacts with regex in Python?

I'm working on VCF files for some purpose. I got a whole collection of contacts in a single VCF file. But I want to extract each contacts separately from the fi

how to Ignore characters other than [a-z][A-Z]

How can I ignore characters other than [a-z][A-Z] in input string in python, and after applying method what will the string look like? Do I need to use regular

Regex returning a value in IE, 'undefined' in Firefox and Safari/Chrome

Have a regex: .*? (rule1|rule2) (?:(rule1|rule2)|[^}])* (It's designed to parse CSS files, and the 'rules' are generated by JS.) When I try this in IE, all

Convert currency string to decimal PHP

I need convert a currency string to decimal for storage it in a database of type "decimal (9,2)". Example: 0 => 0.00 1 => 1.

Remove insignificant trailing zeros from a number?

Have I missed a standard API call that removes trailing insignificant zeros from a number? var x = 1.234000; // to become 1.234 var y = 1.234001; // stays 1.234

Problem with quantifiers and look-behind

### Ruby 1.8.7 ### require 'rubygems' require 'oniguruma' # for look-behind Oniguruma::ORegexp.new('h(?=\w*)') # => /h(?=\w*)/ Oniguruma::ORegexp.new('(?&

How to cache the compiled regex in Go

Below is my golang code. Each time validate method is called my compile method gets executed. I want to compile only once, not each time we call validate. 1)