Questions tagged [boost-regex]

Boost.Regex is a C++ regular expression library with optional Unicode support through ICU.

Boost.Regex is a C++ regular expression library with optional Unicode support through ICU.

296 questions
0
votes
0 answers

Pick the last or 8th value from the listed of matched values in RegEx?

I want to pick the last or 8th value from the list of matched values in RegEx This is my working regex101 Also I want to know, while executing it on my live JS file, how would I use it? Should I use it as /.*Version (\S+)/g or as (?q).*Version (\S+)…
0
votes
1 answer

C# Regex to C++ boost::regex

I have the requirement to match strings in a C++ code of the form L, N{1, 3}, N{1, 3}, N{1, 3} where in the above pseudo-code, L is always a letter (upper or lower case) or a fullstop (. character) and N is always numeric [0-9]. So explicitly,…
MoonKnight
  • 23,214
  • 40
  • 145
  • 277
0
votes
1 answer

qt regex to boost regex conversion for taking number from inside a string

I've have a method in a class that takes a QString and, using a regular expression, it return the first float number (positive or negative) included into the string. This is the method: float MyClass::getNumberFromQString(const QString &xString) { …
Jepessen
  • 11,744
  • 14
  • 82
  • 149
0
votes
1 answer

Regular Expression : Match till the ( character or the end of the buffer) but not the character

Given the following contents in the smb.conf file. How to remove the [share_11999] section using boost(perl version) regex. The problem is the section [share_11999] can be at the end of the file. The following regex almost works except that it…
Talespin_Kit
  • 20,830
  • 29
  • 89
  • 135
0
votes
1 answer

boost regex and range of characters

I have the following code: #include #include #include int main() { const std::string input_data("2014-02-20 12:32:15"); const boost::regex reg_exp("[-:\\d\\s]+"); boost::smatch results; std::cout <<…
FrozenHeart
  • 19,844
  • 33
  • 126
  • 242
0
votes
1 answer

Following regex expression does not work with boost regex

I am doing the following std::string myregex = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$" boost::regex re; re.assign(regex_expr, boost::regex_constants::icase); //Problem - Breaks Any…
MistyD
  • 16,373
  • 40
  • 138
  • 240
0
votes
1 answer

Boost regexp - null-termination of search results

boost::regex re; re = "(\\d+)"; boost::cmatch matches; if (boost::regex_search("hello 123 world", matches, re)) { printf("Found %s\n", matches[1]); } Result: "Found 123 world". I just wanted the "123". Is this some problem…
OJW
  • 4,514
  • 6
  • 40
  • 48
0
votes
2 answers

Regexp for differentiate Country, state, city given format

I have write some regexp for this but i don't get exact one. please check this link. In this i want differentiate Location field into three parts. Ref Link: https://avayacorp.authoria.net/joblist.html country State City Please give more…
Girish
  • 136
  • 1
  • 12
0
votes
2 answers

boost::regex_match gives different result than many online reggex tester

I want to match a string given in an input field. A sample data could be "hello" -> returns true or "\"" -> returns true or "this is a string" -> returns true but """ should not be recognized as a string and should return false when checked by…
0
votes
1 answer

How to specify } (Closing brace) in boost regular expression?

I am using boost 1.54 library in my program. My task is to expand some patterns in a string. One such instance is if a closing brace } is found in the string replace it with > I had written the following regex in my code. boost::wregex…
Ravi Chandra
  • 677
  • 12
  • 24
0
votes
1 answer

Learning boost::regex, matching wildcards

I've just started learning regex. I need to match things like this: hostname21.processName The . is the anchor. Pre and post anchor are represented by [a-zA-Z0-9_] but I'm not sure how to match both of the conditions on either side of the anchor.…
Tyler Jandreau
  • 4,245
  • 1
  • 22
  • 47
0
votes
0 answers

boost::regex extract search term

How to extract a search term using boost::regex in C++ , especially when the term has html entities in it. Eg p=test&test&sort=price Search Term would be 'test&test' p=test&test&sort=price Search Term would be 'test&test' Boost…
Shashi
  • 331
  • 3
  • 12
0
votes
1 answer

Replacing an open-ended HTML regex match in Sublime Text

I've been doing a lot of finding and replacing in Sublime Text and decided I needed to learn RegEx. So far, so good. I'm no expert by any means, but I'm learning quickly. The trouble is knowing how to replace open-ended HTML matches. For example, I…
Kevin Suttle
  • 8,358
  • 3
  • 33
  • 37
0
votes
1 answer

Regex pattern for date

I have the following String: vitals.date_created==2013-7-3 11:23:32 I am using the regex ([a-zA-Z0-9_]+[$.]?[a-zA-Z0-9_]+)+[><=]=?[a-z0-9A-Z'\\.@- ]+ but the regex doesn't work.
Phalguni Mukherjee
  • 623
  • 3
  • 11
  • 29
0
votes
1 answer

Split string using boost::algorithm::split_regex

I'm trying to split a string by using ; as delimiter but not when it is escaped \;. The string can contain characters, numbers, and nested quotes. I'm currently using boost::algorithm::split_regex like so: string data = "hello; world; 100444;…
kendotwill
  • 1,892
  • 18
  • 17