Find All Regex Matches
Jun 28, 2010[code]I am trying to return all number values that match the regex yet this only returns the first one when there are more after it.
View 5 Replies[code]I am trying to return all number values that match the regex yet this only returns the first one when there are more after it.
View 5 RepliesI am working on my application to extract the value from my php page using with the regex pattern. I can extract the value using with the mystrings1 tags with no problem, but I can't be able to extract mystrings1 and mystrings2 tags in the same line.
[Code]...
Trying to parse this and return the following 3 items: [code] Using this regex expression below I get the matches, but drop the leading "-" at the front of each grouping. I get the "-" in the middle of the group though. [code]
View 2 RepliesI'm searching through an html page and I want to put all of the Regex matches into an array? How would I go about doing this? I see the Regex.Matches but I can't quite understand how to use it an MSDN sucks when it comes to explaining it.
View 4 RepliesI am just can't get my head around this.I've got this Regex:
(?<=Photo:)(.+?)(?=Stock)|(?<=Stock Code:)(.+?)(?=Make:)|(?<=Make:)(.+?)(?=Model:)|(?<=Model:)(.+?)(?=Year:)|(?<=Year:)(.+?)(?=Price:)|(?<=Price:)(.+?)(?=Description:)|(?<=Description:)(.+?)(?=Photo:)|(?<=Description:)(.+?)(?=Page:)
[code]....
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://www.web.com")
Dim response As System.Net.HttpWebResponse = request.GetResponse
[code].....
Rename files in a folder who's name matches a regex pattern ?[code]...
View 3 RepliesI've been working on this RegEx for the past day or so and I think I have it worked out so that it returns the data I want. First a little background.I have a content editor that users will be able to edit web pages. They can format text, add links, etc.. standard content editor stuff. When they click save, the editor provides the ability to get the content (editor.Content) and put it into a string. What I want to do is get any links (<a> tags) and find out if they are internal or external links and if they are PDF files.
Here is the Expression I've come up with:
<a[^<>]*hrefs*=s*[""'](?<domain>https?://[^/s'""]*)*/?(?<path>/?[^s""]+?)?[[>""']
With this, I am able to separate the domain (if it has one) and the path out. Then, I loop through the matches...
dim matchColl as MatchCollection = Regex.Matches(editorContent, regExString)
For Each m as Match in matchColl
If m.Groups("domain").value <> myInternalDomain and m.Groups("domain").value <> "" then
'this is an external domain... do some stuff
[code]....
My question is this... the parts where I 'do some stuff' to the values, what would be the best way to get that back into my 'editorContent' string? I could probably put the editorContent into a StringBuilder and do a whole bunch of replaces on it, but is that very efficient?So, for example, with the PDF, I want to specify that it open in a new window (target="_blank") and for the external URL, add some javascript code into the onclick attribute.
Question:Given a SQL string like
CREATE VIEW TestView AS
SELECT value1, value2
FROM TABLE_0[code]...........
for each strObjectName in tables, to check whether or not the view depends on this object.But this fails on table_12 (and results in cyclic dependencies) for example, because tables contains "table_1". Aaargh.I need a regex that can check if the view definition contains a function name, table-valued function or another view...
(
For checking with
System.Text.RegularExpressions.Regex.IsMatch([code].....
But it fails, plus it doesn't account for object names embraced in brackets, like
"[TABLE_NAME]"
i have to search a string for a few words eg, dog, cat, lion but i want regex to fail if lizard is found in the string even if it contains cat, dog or lion.ismatch(pass) "dog|cat|lion" "This is not your average cat!"ismatch (fail) ??? "This is not your average cat! It's a lizard."??? - here the regex statement is unknown word spaces and boundaries or lower/uppercase is not a concern. I run the string through Replace(" ", "").Trim(" ").ToLower before handover to Regex.
View 3 RepliesI'm currently working on a greedy string tiling algorithm to find out matches between two strings, but there is something wrong with the string, they are not marked right
Here is the code am trying:
Sub GST2(ByVal str1 As Array, ByVal str2 As Array)
Dim a, b, j, cnt, jj, max_a, max_b As Integer
' Do While maxmatch > 3
[Code].....
I have a string that contains multiple instances of a dollar sign followed by a positive number. I need to grab each instance out using regex. Here's an example of a string:
"This that $1 who $2" Here's what I have so far using vb.net: Dim wordSplitMatches As Match = Regex.Match("This that $1 who $2", "($d+)+")This works great for grabbing the $1 but how do I set it up so that I get multiple groups with all the matches in?
[Code]...
Trying to parse this and return the following 3 items:
-30.25 31.46 -27.46 31.74
-24.57 32.03 -16.86 32.88
-13.82 33.19 -9.69 33.62
Using this regex expression below I get the matches, but drop the leading "-" at the front of each grouping. I get the "-" in the middle of the group though. Here is the expression I currently use.
Dim regex As New System.Text.RegularExpressions.Regex("{0,1}d{1,2}.{0,1}d{0,2}{1}-{0,1}d{1,2}.{0,1}d{0,2}s{1}-{0,1}d{1,2}.{0,1}d{0,2}s{1}-{0,1}d{1,2}.{0,1}d{0,2}, RegexOptions.Singleline)
[code]......
I need your help to find the right pattern to extract a string that i need.. The problem is that i have to extract all there is between this caracters:<a href="/url?q=(text to extract whatever it is)& I tried this pattern, but it's not working for me! : /(?<=url\?q=).*?(?=&)/
i'm programming in Vb.net, this is the code, but i think that the problem is that the pattern is wrong:
Dim matches As MatchCollection
matches = regex.Matches(TextBox1.Text)
For Each Match As Match In matches
listbox1.items.add(Match.Value)
Next
I'm needing to use Regex to find a dynamic text. It will always be found between the same things. Now, I'm sure that made little sense, so let me clarify. I have a rich text box full of text. I am needing to use a Regex method to find a certain string of that text that is always different. This string will be located between the same two pieces of text every time.
For Example: If this is my string: id ="user_name" ><img style ="display: block;" usr ="resentful" I need to find the text in between id ="user_name" ><img style ="display: block;" usr =" and ".
var rawItemInfo={"stock":"In Stock","shipping":"<em>Free Shipping</em>","finalPrice":"56.99","itemInfo":"<div class="grpPricing"><div class="wrapper"><div class="current" id="singleFinalPrice"><span class="label">Now: </span><span>$</span>56<sup>.99</sup></div></div><div
I want to extract two information from above string
1: Stock Status "In Stock" which will come always after "Stock":
2 Price $56.99 which is there some before....<span>$</span>56<sup>.99</sup> some code after..
Ive been searching the Stackoverflow but couldnt find the exact thread that my problem is this, i want to be able to find and take out any occurances of 8 digits wihtin a string.
Dim SetOfMatches As MatchCollection
Dim MyRegex As New Regex("A^d{8}$A")
Dim TestString As String = "testing 12345678 testing"
myMatches = myRegex.Matches(TestString)
For each Row as Match in myMatches
console.writeline(row.value)
Next
this doesnt not generate any hits. but i want to find the 8 digit occurance in the middle of the string.
I am very basic in RegEx.
I need to find illegal characters in a windows forms textbox
The textbox text is sent as an sms text message and illegal characters are not allowed
e.g 1 client pasted some text from a word document into the texbox and the ' in msword appears as slanting ' in the textbox (see below)
e.g msword text - This is a new test of the Services
after pasting in textbox - This is a new test of the Services
The sms company have advised the slanting apostrophe is a unicode character
How can I find characters like above so I can remove them before sending the sms text
#@$#^@ regex have i don't know to use it yet so something like
<img src="find this" alt="Click if
<img src="/validator/11917876/1268416778.gif" alt="Click if
I'm trying to get this src and have PictureBox1.Load[URL] & "regex code" for the captcha to see if over picturebox1
have a 1mb file, should get the pattern from it
pattern should be like this
6numbers + 10&FF + 6numbers
in the hex binary editor it looks like this
[code].....
I have a string like 30+20%. Now I want to replace 20% with (20/100). Thats it.
View 6 Repliesi want to be able to find the text found with the TITLE attribute which looks like this:
[Code]....
I am using a simple regular expression (in C#) to find a whole word within a block of text.
The word may appear at the beginning, end or in the middle of a the text or sentence with in the text.
The expression I have been using word has been working fine however if the word included a special character (that has been escaped) it no longer works. The boundary is essential so that we do not pick up words such as vb.net as a match for .net.[code]...
I have to match string like "DAY1","DAY2","DAY3"....."DAY31" with regex in vb.net. I tried something like this - ^?DAY(0[1-9]|[12][0-9]|3[01])$ but it did not work.
The pattern should have succesfull match if the source string is either DAY1 or DAY2 or DAY3 to DAY31 like so.
The sad truth about this post is that I have poor regex skills. I recently came across some code in an old project that I seriously want to do something about. [code]...
View 5 RepliesI have a string which consists of the raw HTML of a webpage. I would like to search for the first use of /imgres?imgurl= within the string and display the url of an image which follows exactly after it in a text box. Below is an example of part of the string: [URL]..In this case it would find /imgres?imgurl= then it would display [URL]...
View 2 RepliesI have the following html contained in a string.
<tr>
<td>Hello</td>
</tr>
[Code]....
I would like to use RegEx to find the <tr></tr> that contains the text "World". The difficulty is that there might be other <td> around the one that contains the search text. So we need to be able to search for the <tr> and </tr> nearest to the search text with any text between the <tr> and the search text.
The result of the match would be.
<tr>
<td>World</td>
</tr>
I'm using vb.net by the way.
Using VB.NET, Is there a way to do this RegEx call in 1 step... instead of 2-3? I'm trying to find the word "bingo", or whatever is between the START and END words, but then also inside the inner FISH and CAKES words. My final results should be just "bingo".
Dim s1 As String = "START (random string) FISH bingo CAKES (random string) END"
[Code]...
I am having an issue where I am using regex.Replace to replace part of a string. The basic idea is that I want to capture the beginning of the string then replace the end of the string with a value from code. For an example pretend I have a string that says "Test Number " followed by number and I want to increment that number. I capture the "Test Number " but when I try to concatenate that capture with the new number it treats the capture ($1) as a literal and replaces the entire string with $1[new number].
[code]...
This will output "We are on Test Number 2", as expected. how I can use a variable in the replacement string portion of the Regex.Replace when including a captured group?
I want to take the text and some special characters between the xml tags.. My input file contains:
[Code]...
now i want the Regex to take text and the special characters between the tags <line>,<inline>..