I want a regex for the following string:  For more:  [Click here](https://www.google.ca) and [click me](https://www.google.com)   For that My current regex is as follows.  /\[.*\]\((((https?\:\/\/)|(www\.))(\S+))/ig  Give me the regex with that I can find two different links in the same line.  Right now I am finding 1 combined regex for both of them.
3211
I have this gigantic ugly string: J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM J0000010: Project name: E:\foo.pf J0000011: Job name: MBiek Direct Mail Test J0000020: Document 1 - Completed successfully  I'm trying to extract pieces from it using regex. In this case, I want to grab everything after Project Name up to the part where it says J0000011: (the 11 is going to be a different number every time). Here's the regex I've been playing with: Project name:\s+(.*)\s+J[0-9]{7}:  The problem is that it doesn't stop until it hits the J0000020: at the end. How do I make the regex stop at the first occurrence of J[0-9]{7}?
98543
I am trying to use grep and cut to extract URLs from an HTML file. The links look like:  &lt;a href="http://examplewebsite.com/"&gt;   Other websites have .net, .gov, but I assume I could make the cut off point right before &gt;. So I know I can use grep and cut somehow to cut off everything before http and after .com, but I have been stuck on it for a while.
9185
Just starting to explore the 'wonders' of regex.  Being someone who learns from trial and error, I'm really struggling because my trials are throwing up a disproportionate amount of errors...  My experiments are in PHP using ereg().  Anyway.  I work with first and last names separately but for now using the same regex.  So far I have:  ^[A-Z][a-zA-Z]+$     Any length string that starts with a capital and has only letters (capital or not) for the rest.  But where I fall apart is dealing with the special situations that can pretty much occur anywhere.   Hyphenated Names (Worthington-Smythe)   Names with Apostophies (D'Angelo)   Names with Spaces (Van der Humpton) - capitals in the middle which may or may not be required is way beyond my interest at this stage. Joint Names (Ben &amp; Jerry)   Maybe there's some other way a name can be that I'm no thinking of, but I suspect if I can get my head around this, I can add to it.  I'm pretty sure there will be instances where more than one of these situations comes up in one name.  So, I think the bottom line is to have my regex also accept a space, hyphens, ampersands and apostrophes - but not at the start or end of the name to be technically correct.
66844
How do you combine two jQuery search results? eg:  var $allFoos = $('.foo'),     $allBars = $('.bar')     $allFoosAndBars = $allFoos + $allBars;   Obviously, I just made up that last line, but I hope it makes it sorta clear what I mean. To be clear, the example is greatly simplified, and it could be any arbitrary sets i'm talking about, so $('.foo, .bar') is not what I'm after.
90488
I would like to redirect a URL with uppercase characters http://localhost/A/B to a lowercase version http://localhost/a/b using the .htaccess file. Using regex I can capture A and B but is it possible to convert them to lowercase?
113533
I'm trying to write a regex that will parse out the directory and filename of a fully qualified path using matching groups.  so...  /var/log/xyz/10032008.log   would recognize group 1 to be "/var/log/xyz" and group 2 to be "10032008.log"  Seems simple but I can't get the matching groups to work for the life of me.  NOTE:  As pointed out by some of the respondents this is probably not a good use of regular expressions.  Generally I'd prefer to use the file API of the language I was using.  What I'm actually trying to do is a little more complicated than this but would have been much more difficult to explain, so I chose a domain that everyone would be familiar with in order to most succinctly describe the root problem.
33685
Pretty basic question, I'm trying to write a regex in Vim to match any phrase starting with "abc " directly followed by anything other than "defg".   I've used "[^defg]" to match any single character other than d, e, f or g.  My first instinct was to try /abc [^\(defg\)] or /abc [^\&lt;defg\&gt;] but neither one of those works.
6643
I am doing something where I realised I wanted to count how many /s I could find in a string, and then it struck me, that there were several ways to do it, but couldn't decide on what the best (or easiest) was.  At the moment I'm going with something like:  string source = "/once/upon/a/time/"; int count = source.Length - source.Replace("/", "").Length;   But I don't like it at all, any takers?  I don't really want to dig out RegEx for this, do I?  I know my string is going to have the term I'm searching for, so you can assume that...  Of course for strings where length > 1,  string haystack = "/once/upon/a/time"; string needle = "/"; int needleCount = ( haystack.Length - haystack.Replace(needle,"").Length ) / needle.Length;
118631
A friend asked me this and I was stumped: Is there a way to craft a regular expression that matches a sequence of the same character? E.g.,  match on 'aaa', 'bbb', but not 'abc'?  m|\w{2,3}|    Wouldn't do the trick as it would match 'abc'.  m|a{2,3}|    Wouldn't do the trick as it wouldn't match 'bbb', 'ccc', etc.
3542
I have a value like this:  "Foo Bar" "Another Value" something else   What regex will return the values enclosed in the quotation marks (e.g. Foo Bar and Another Value)?
43887
What's the best/most efficient way to extract text set between parenthesis? Say I wanted to get the string "text" from the string "ignore everything except this (text)" in the most efficient manner possible.  So far, the best I've come up with is this:  $fullString = "ignore everything except this (text)"; $start = strpos('(', $fullString); $end = strlen($fullString) - strpos(')', $fullString);  $shortString = substr($fullString, $start, $end);   Is there a better way to do this? I know in general using regex tends to be less efficient, but unless I can reduce the number of function calls, perhaps this would be the best approach? Thoughts?
67727
How can I get the value between quotes with an RegEx  for example I want to find all the parameters from the function test  &lt;html&gt;    test("bla");    print("foo");    test("moo"); &lt;/html&gt;   The result must be { "bla", "moo" }
3235
I would like to get the multi pattern match with implicit AND between patterns, i.e. equivalent to running several greps in a sequence:  grep pattern1 | grep pattern2 | ...   So how to convert it to something like?  grep pattern1 &amp; pattern2 &amp; pattern3   I would like to use single grep because I am building arguments dynamically, so everything has to fit in one string. Using filter is system feature, not grep, so it is not an argument for it.    Don't confuse this question with:  grep "pattern1\|pattern2\|..."   This is an OR multi pattern match.
12435
How can I fetch a domain name from a URL String? Examples: +----------------------+------------+ | input                | output     | +----------------------+------------+ | www.google.com       | google     | | www.mail.yahoo.com   | mail.yahoo | | www.mail.yahoo.co.in | mail.yahoo | | www.abc.au.uk        | abc        | +----------------------+------------+  Related:
18973
I need to write a function that receives a string and a regex. I need to check if there is a match and return the start and end location of a match. (The regex was already compiled by qr//.)  The function might also receive a "global" flag and then I need to return the (start,end) pairs of all the matches.  I cannot change the regex, not even add () around it as the user might use () and \1. Maybe I can use (?:).  Example: given "ababab" and the regex qr/ab/, in the global case I need to get back 3 pairs of (start, end).
101419
I've got a string in .NET which is actually a URL.  I want an easy way to get the value from a particular parameter. Normally, I'd just use Request.Params[&quot;theThingIWant&quot;], but this string isn't from the request.  I can create a new Uri item like so: Uri myUri = new Uri(TheStringUrlIWantMyValueFrom);  I can use myUri.Query to get the query string...but then I apparently have to find some regexy way of splitting it up. Am I missing something obvious, or is there no built in way to do this short of creating a regex of some kind, etc?
14665
I've been looking for a simple regex for URLs, does anybody have one handy that works well?  I didn't find one with the zend framework validation classes and have seen several implementations.