# Все вопросы: [regex]

3 742 вопросов

2ответов
179 просмотров

### Regular expressions question

I've got the following string : const std::string args = "cmdLine=\"-d ..\data\configFile.cfg\" rootDir=\"C:\abc\def\""; // please note the space after -d I'd like to split it into 2 substrings : std::str1 = "cmdLine=..."; and std::str2 = "rootDir=..."; using boost/algorithm/string.hpp ....

4ответов
6681 просмотров

### Regular expression to extract all words starting with colon

I would like to use a regular expression to extract "bind variable" parameters from a string that contains a SQL statement. In Oracle, the parameters are prefixed with a colon. For example, like this: SELECT * FROM employee WHERE name = :variable1 OR empno = :variable2 Can I use a regular exp...

2ответов
2041 просмотров

### extracting a number from a string in Java

I have a string with a number inside and I want to retrieve that number. for example if I have a string "bla bla 45 bla bla" I want to get the number 45. I have searched a bit and found out that this code should make the work Matcher matcher = Pattern.compile("\d+").matcher("bla bla 45 bla bla")...

2ответов
1282 просмотров

### How to write regex to extract FlickR Image ID From URL?

I'm looking to do do two things, and I am looking to do them in a beautiful way. I am working on a project that allows users to upload flickr photos by simply entering their flickr image URL. Ex: http://www.flickr.com/photos/xdjio/226228060/ I need to: make sure it is a URL that matches the f...

2ответов
135 просмотров

6ответов
475 просмотров

### How to verify regexp patterns?

What are the common ways to verify the given regex pattern works well of the given scenario and check the results ? I would like to know in general , not in the particular programming language and what is the best way to learn about writing regular expression ?

2ответов
3864 просмотров

### Regex 2 digits separated by commas, not all required

I need a regex for the following input: [2 digits], comma, [two digits], comma, [two digits] The 2 digits cannot start with 0. It is allowed to only enter the first 2 digits. Or to enter the first 2 digits, then a comma en then the next 2 digits. Or to enter the full string as described abo...

3ответов
1567 просмотров

### Extracting info from html using PHP(XPath), PHP/Python(Regexp) or Python(XPath)

I have approx. 40k+ html documents where I need to extract information from. I have tried to do so using PHP+Tidy(because most files are not well-formed)+DOMDocument+XPath but it is extremely slow.... I am advised to use regexp but the html files are not marked up semantically (table based layout...

5ответов
6177 просмотров

### Check if a string contains a certain number

I have a string 8,7,13,14,16 Whats the easiest way to determine if a given number is present in that string? $numberA = "13";$string = "8,7,13,14,16"; if($string magic$numberA){ $result = "Yeah, that number is in there"; } else {$result = "Sorry."; } Looking for magic.

1ответов
2419 просмотров