Perl match in context [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 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+)/) {
...
}

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*([^&]*)(?:&|$)

How would you parse in bash #extra_modules <string> [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
How would I parse
#extra_modules some string
in kdump.conf file to get "some string" as actual output in bash script ?
Thanks !
grep "#extra_modules" kdump.conf | cut -c 16-
grep finds the lines with the phrase "#extra_modules", and cut selects all the characters after the first space

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.

Search and Replace comment out entire line Java/Eclipse [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
Say I have a line
blah.field
that needs to be commented out
//blah.field
which is referenced in a project in multiple files
Is there a way to comment this line in all places using a simple eclipse search and replace?
Replace regular expression:
^blah\.field$
with
//$0
^ = begin of line (here)
$ = end of line
$0 = the entire found match

Regex match everything between to strings - Complex [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 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