I need this to be done in Oracle SQL (10gR2). But I guess, I would rather put it plainly, any good, efficient algorithm is fine.
Given a line (or sentence, containing one or many words, English), how will you find the last word of the sentence?
Here is what I have tried in SQL. But, I would like to see an efficient way of doing this.
...
I am new to regex (15 minutes of experience) so I can't figure this one out. I just want something that will match an alphanumeric string with no spaces in it. For example:
"ThisIsMyName" should match, but
"This Is My Name" should not match.
...
I've written a regex to split a search string into its component parts. Features include:
Operators: +, -, AND, OR
Word grouping by quotes (single and double for now)
Correctly ignoring apostrophes
So:
((?<=^|\s)(?:[\+\-]?"[^"]+"(?=\s|$)|[\+\-]?'[^']+'(?=\s|$)|[\+\-]?\S+|AND|and|OR|or)(?=$|\s))
What is the easiest way to exclude ...
I was looking to split a string based on a regular expression but I also have interest in keeping the text we split on:
php > var_dump(preg_split("/(\^)/","category=Telecommunications & CATV^ORcategory!=ORtest^caused_byISEMPTY^EQ"), null, PREG_SPLIT_DELIM_CAPTURE);
array(4) {
[0]=> string(34) "category=Telecommunications & CATV"
...
I know I can get whether 2 strings are equal in content, but I need to be able to get the number of characters that differ in the result of comparing 2 string values.
For instance:
"aaaBaaaCaaaDaaaEaaa"
"aaaXaaaYaaaZaaaEaaa"
so the asnwer is 3 for this case.
Is there an easy way to do this, using regex, linq or any other way?
EDIT:...
Can somebody tel me how a regex should look like which searches in
"V. Guimaraes - FC-Porto"
and gives out:
"V. Guimaraes"
"FC-Porto"
EDIT: The Source also could be:
"V. Guimaraes - FC-Porto 2:2"
"V. Guimaraes - FC-Porto Foo"
...
...
How would you go about embedding youtube vidoes automatically from the URI.
Say for example you type in a textbox:
The quick brown fox jumped over this video http://www.youtube.com/watch?v=5qm8PH4xAss&feature=player_embedded and then fell into this http://www.youtube.com/watch?v=lSCSmpV8Nn8&feature=hp_SLN&list=SL
You pr...
In Django URL patterns, what's the proper way to take this URL:
http://example/i/fb/#access_token=12345678910|b1827b912847b81938747b91849-193867192305817|EKWOGJhcinWIjWij8174-NgjRojb&expires_in=0
And create variables:
access_token = 12345678910|b1827b912847b81938747b91849-193867192305817|EKWOGJhcinWIjWij8174-NgjRojb
expires_in = ...
Hello Everybody.
I'm trying to parse links with Regex with Java.
But, i think its getting to slow. For example. To extract all links from:
http://news.google.com.ar/nwshp?hl=es&tab=wn
is spending 34642 milliseconds (34 seconds!!!)
Here is the regexp:
private final String regexp = "<a.*?\\shref\\s*=\\s*([\\\"\\']*)(.*?)([\\\...
Major bash-noob here. Writing my second program again. For my homework, I need to write a number of grep statements using regexps.
This is the first one I'm trying to write.
I'm saving it as grep.bash:
#!/bin/bash
egrep bright_side_of_life 'the'
The error I get is :
egrep: the: no such file or directory
...
One of my homework questions is to search using grep an lines that contain the word 'death' or 'breath'.
I know the [] operator acts as an or, but how do I use it to specify 'd' or 'br' ?
This won't work:
egrep [dbr]eath test_file
...
Hi All,
I was wondering, what would be the best data structure to represent a DFA ?
I am looking at converting a regular expression to a DFA and make this particular functionality as a library in java.
The main thing is that, each entity in the regex carries a set of value rather than a single string value like "car" . In my case , ...
I'm not really that good with regex, but I understand the basics. I'm trying to figure out how to do a conditional replace based upon a certain value in the match. For example:
Suppose I have some nested string structure that look like this:
"[id value]"//id and value are space delimited. id will never have spaces
id is some strin...
how do i extract the part between the brackets in javascript regular expressions:
answer_postal_address[address]
I tried this:
/^\w*/g
which works but i wasn't sure if this was correct...
...
i want to find a substring 's index postion,but the substring is long and hard to expression(multiline,& even you need escape for it ) so i want to use regex to match them,and return the substring's index,
the function like str.find or str.rfind ,
is there some package help for this?
...
What is the C# equivalent of this pseudo-code?
var pattern = ...;
var lookup = new Dictionary<string, string>();
foreach (var group in new Regex(pattern).Matches())
{
lookup[group.Name] = group.Value;
}
I don't see any System.Text.RegularExpressions group-related object that exposes the group name.
What am I missing?
What I'm a...
John Resig wrote a nifty Class function, swanky. I'm trying to figure out what is going on, and have pretty much everything figured out except a single line:
fnTest = /xyz/.test(function () {xyz;}) ? /\b_super\b/ : /.*/;
A couple things immediately jump to mind, first xyz is never initialized as a variable; so why then does this work?...
I have a pretty simple question. What is the best (highest-performance/lowest memory-usage, etc.) way to compile a regular expression in AS3?
For instance, is this:
private var expression:RegExp = new RegExp(".*a$");
private function modify():void {
/* uses "expression" to chop up string */
}
Faster than this:
private var expr...
i am writing a php script that compress local javascript files into one from an html page. Now i want to delete local references except external javascript files.
for example, i have following variables.
$my_domain = "mysite";
$base_url ="http://www.mysite.com"
I want to delete all local javascript references except external. local j...
i have a texaarea which put regular expression to match html,so it's senstive to \r\n & \n,
and i don't know textarea how's doing with this,
when i write a wring regular expression with muliple lines,put these string to the textarea,then send to the server process match procedure,it will not work,i think the main reason is \r\n \n symbo...