Regex match everything between to strings - Complex [closed] - regex

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have this code:
http://pastebin.com/7MZHVu2T
I need to get everything between 'public function addTopicParticipants' and 'public function deleteTopics'
I tried:
/public function addtopicParticipants(.*?)public function deleteTopics/
This is the only thing I remember.

preg_match('/public function addTopicParticipants(.*?)public function deleteTopics/s', $text, $match;
$found = $match[1];
The s modifier allows . to match newlines.
Tested here

Related

I need basic regex code [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
/edit?o=U&video_id=xxxxxxxxxxxx&show_mt=1
/edit?o=U&show_mt=1&video_id=xxxxxxxxxxxx
I want get video_id query using regex (xxxxxxxxx)
I am using VB.NET
Thanks for help!
M. Deger
Edit: I want only regex code eg: [^?]+(?:\?video_id=([^&]+).*)?
Untested:
(?<=video_id\s*=\s*)[^&]*(?=&|$)
or, result in capture group 1
video_id\s*=\s*([^&]*)(?:&|$)

Regular expression for all lower case with _ allowed [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
what is the regular expression to validate a string. the string should contain
all lower case
_ is allowed in the string.
Thanks in advance.
You need to use regex pattern
^[a-z_]*$
You can use a POSIX class as an alternative to a simple character class to achieve this:
[[:lower:]_]*

String conversion and concatenation [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I have the following line of XML:
<indexentry><secondaryie>definition, 3/2/4</secondaryie></indexentry>
And I need a regex that matches the above and converts it as below:
ABC3(the first number)/P-2(second number)-4(third number)
How can I do this?
Use this regex:
([0-9]+)/([0-9]+)/([0-9]+)
And from captured groups #1, #2, #3 make your string:
ABC3\1/P-2\2-4\3

RegEx - Add new conditions to existing regex [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I currently have this Regex:
.*[a-z]$|.*[A-Z]$|.*[0-9]$
I need to add the following to the existing - /:.#[]()
Does anyone know how to do it?
You don't need multiple OR conditions. Have only one and include special characters also:
[0-9A-Za-z\/#:.()\[\]]
Per your comments, this should do it for you:
^[a-zA-Z0-9/:.#\[\]()]+$
This will match a string containing only the characters you've specified.

Perl match in context [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I would like to find a word in a text file, and save it to a variable along with some characters. for example in the text file it would be something like:
Isoelectric Point = 6.2505
I'll be looping through a directory of files, so the value of the Isoelectric Point will change, and that is why I need the characters after the match to be saved to a variable.
if (my ($point) = $str =~ /Isoelectric Point = (\S+)/) {
...
}