I wish to match
&v=
and before
">
is there a regex match i could use
Example:
<a accesskey="1" href="/watch?gl=GB&client=mv-google&hl=en-GB&v=ubNF9QNEQLA">Test Your Awareness : Whodunnit?</a>
i only need the ubNF9QNEQLA
Thanks
/&v=([^(">)]+)/
/&v=(.*?)">/
The question mark tells the wild char matching to be lazy so it will stop at the first "> rather than at the last one.
/&v=(.*)>/
This solved it
Related
I need a regrex query to match any string having given character. So i tried for example
SELECT wt.CHGUSER FROM "CDB"."WTBALL" wt where REGEXP_LIKE (wt.CHGUSER, '^\d*115*$');
So i am expecting to fetch all the strings having 115 somewhere in between each string. I tried many combinations but i am getting empty column or weird combination.
Are you sure You need a regex? You write "all the strings having 115 somewhere in between each string", but test for a all-digit string with "115" somewhere...
Btw. this could be done also without regex:
WHERE LOCATE('115', wt.CHGUSER) > 0
AND TRANSLATE(wt.CHGUSER, '', '0123456789') --if You really want to test all-digit string
why not use the native "LIKE" expression?
where wt.CHGUSER like '%115%'
This will give different results than your regexp because your expression is looking for '115' so long as there is a digit immediate before and after it. A more generic regexp, which matches your question, would be '.*115.*'
What about -
REGEXP_LIKE (wt.CHGUSER, '^*\d115\d*$');
I have an array that have some symbols that I want to remove and even thought I find a solution, I will like to know if this is the right way because I'm afraid if I use it with array will remove the character that I might need on future arrays.
Here is an example item on my array:
$string1='22 | logging monitor informational';
so I try the following:
$string1=~ s/\s{6}\|(?=\s{6})//;
So my output is:
22 logging monitor informational
Is the other way that best match "|". I just want to remove the pipe character.
Thanks in advance
"I want to remove just the pipe character."
OK, then do this:
$string1 =~ s/\|//;
This will remove the first pipe character in the string. (You said in another comment that you don't want to remove any additional pipe characters.) If that's not what you want, then I'd suggest telling us exactly what you do want. We can't read minds, you know.
In the mean time, I'd also strongly recommend reading the Perl regular expressions tutorial.
I searched all the web but did not solve my problem.
I need a regular expression to match or replace a word folowed with a double quote.
Example :
uniquehereuniqueyouunique"can"uniquegetuniquefoounique"bar"
I need to replace all unique" by something (ex notunique). I tried :
preg_replace("/unique\"/", 'notunique', $contents);
but that don't match.
thanks for your help
I found it !
preg_replace('/unique."/', 'notunique', $contents);
I have a text file like so:
dave ran very quickly
dan very slowly ran
I am doing a regex to look for the word "ran" but I also need to know where it starts (in the first case it is character 6, in the second case it's 17).
I have (though it isn't much):
for(#lines){
if(/ran/){
# find where ran is so we can continue parsing
}
}
It's easy:
my $ran_pos = $-[0];
See the perlvar man page for a detailed description of the #- array.
I believe the index function is what you're looking for.
Here are a couple links:
http://perlmeme.org/howtos/perlfunc/index_function.html
http://www.misc-perl-info.com/perl-index.html
index STR,SUBSTR will return the position of a substring within a string.
i would like to get everything inbetween &v= and "> using a regex expression,
NSString *YouTubeRegex = #"/amp;v=([^(\">)]+)/";
But that regex is not returning any matches ? i know the coding is correct just not the regex expression any help ?
Thanks
Try this :
/amp;v=(.+?)">/
http://www.rubular.com/r/Lqb63CsN2p
Assuming the regex engine is Perl-like:
"/&v=(.*)>/"
should do the trick.