Using Regex In Vb?
Jun 15, 2009i would like to use the following regex in VB.net:(d+.d+)|(??????)
how would i do it? i actually need to edit a string to put it in the specified format
i would like to use the following regex in VB.net:(d+.d+)|(??????)
how would i do it? i actually need to edit a string to put it in the specified format
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>..
I'm creating a program in VB.NET to output multiple images. Some images will have the same file name. If there is multiple files with the same name I want to add "_1_" to the end of the file name. If the "_1_" file already exists I want to increment the 1 to be "_2_". If this file already exists I want to continue incrementing the number ultil it doesn't exist. So for example "filename", filename_1_", "filename_2_", etc. Here is the code that I have tried
[Code]...
I've been working straight since yesterday trying to get this to work. I'm a noob to RegEx and I've tested out about 5 different RegEx "builders" but each of them require you to navigate through the options to build the Regex...each of them has failed when I try to use them.Is there an application out there free/paid where you select the line you want to grab and the RegEx is auto generated from that highlight rather than having to try to build the line of code? [code]
View 1 RepliesI am using UrlRewriter.NET for urlrewriting...how do i write the regular expression for
[URL]
in this format <rewrite url = "~/ViewProfile/([^/.]+)" to="~/ViewProfile.aspx?uid=$1" /> what should be the rewrite url for [URL]
EDIT: Rewrite code in web.config file
<configuration>
<configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
[code]....
I got xml document I want to parse. Here is example:[code]I want to get list of those to textbox like item1:1 newline item2:2 newline item3:3So its just like name+id and same for next..But sofar I got only item1 newline item2 newline item3
View 6 RepliesI've got an application which loads up some Excel files and imports them into a database.There are only certain of the sheets which I want, which are all timestamped and have either an am or pm on them. I put together a regex expression to look for that in the sheet name and skip it if it doesn't meet that criteria as:
View 6 Repliesi have a string similar to this one:
Hi, <<
ame>> <<surname>>, this is an example << est>>.
I what a regex that match and split this string in:
"Hi, "
<<
ame>>
" "
[code]....
I tried this one: (<<*.*?>>)|(>>*.*?<<), but doesn't work.
Well I am currently trying to get the word/text in between these 2 things
[Code]...
I have a html like this :
<h1> Headhing </h>
<font name="arial">some text</font></br>
some other text
In C#,
I want to get the out put as below. Simply content inside the font start tag and end tag
<font name="arial">some text</font>
I hired a coder to code me something in Regex. The issue was that he coded it in Visual Basic and I need it in C#. I tried using a converter but it didnt fix the issue.
string iamtwit = ss("http://www.mailinator.com" + GetBetween(GetBetween(iamtwit1, matches.ToString(), "</a>"), "<a href=", ">"));MessageBox.Show(GetBetween(matches1.ToString(), "<a href="", Strings.Chr(34)));
Here is the original code:
Dim iamtwit As String = ss("http://www.mailinator.com" & GetBetween(GetBetween(iamtwit1, matches.ToString, "</a>"), "<a href=", ">"))
MsgBox(GetBetween(matches1.ToString, "<a href=""", Chr(34)))
The error messages I am getting are:
The name 'GetBetween' does not exist in the current context
The name 'Strings' does not exist in the current context
I'm currently trying to get a regular expression to work and I can't seem to get it to, I've used the regex that I am using on an online tester and the text that I'm searching for is being selected alright, but I don't appear to be able to get it to work in VB.Net, so I was wondering if anyone would be willing to give me a hand.
The code I have is;
Private Sub getLink(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs)
[code].....
I would like to use regex for a txt file as follows. What I want to do is to get the whole text if CRC is other than 00000000. The content of the file below has 2 blocks of data below. And I should get the second one after the regex operation.
[Code]...
I'm using REGEX to scan the following two bits of javascript and get the stream url in the javascript codes below the regex.
REGEX:
Dim matchs As MatchCollection = New Regex("(window.SC.bufferTracks.push(){1}[^)^;]*();){1}").Matches(input)
Dim match As Match
For Each match In matchs[code].....
why it's working on one javascript, but not the other? (i've tested it on several, and it works on some and not on the others
How can i get the String Between this I tried everything but I just cant make it:
This is the String:
Quote:
<a title="I Need this String" href="/page/view_7894135/I_Need_This_String.html" class="tinylink">I Need this String</a>
This was my RegEx but it doesent work. I tried everything:
(?<=title="">).+(?="")
the string ordering does not matter Z, X, or c can be any order in the string but the regex must fail if all three are not present. I can easily do Three different regex but was wonder can this be done with one expression?
View 12 RepliesI want create macro for replacing. But my problem is how to use regular expression in Visual Basic's macro for Visual Studio?
document.Selection.ReplacePattern("test{[^']+}test", "testAAAAtest")
Doesn't work.
Use RegEx to get an Image URL?[code]...
View 3 RepliesI am using LINQ and RegEx to select a list of files that need to be zipped, based on information given by the user (includefiles and excludefiles) .
This code works great until there is an escape character in the path, such as C:Program Files(x86). At that point, no files are selected for zipping.
I'm very unfamiliar with LINQ and RegEx, but I think I need Regex.Escape("(") (plus any other characters). I just don't know how I should go about putting it into the code.
I can't find any examples that use LINQ and also include Regex.Escape.
Dim DI As New DirectoryInfo(sDirectory)
Dim FileList As IEnumerable = From F In DI.GetFiles("*.*", SearchOption.AllDirectories) _
[Code]....
i am not sure how to use those as a regex coding so basically i need help with translating the following shown below into regex coding: -(e.g. car as regex = new regex(" ") )
1. Car Licence Number (e.g.1ASD324)
2. Date(e.g. dd/mm/yy)
I am trying to validate a password by using a regex.
* Must be between 6 to 16 characters long
* Must contain atleast 1 uppercase letter
* Must contain atleast 1 lowercase letter
* Must contain atleast 1 numeric "digit"
So far so good ...
(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{6,16})$
Can optionally have any number of special characters listed below.
I have :
[Code]...
I think I have explained my problem properly..
I have a RegEx I am using in vb.net and i can get all the matches of the text but i want to get the first match of the text, this is what i am using.
[Code]...
I need to insert a word after every X (i.e. 4,5,6 etc) sentences in given text. I feel regex would be compact and good solution. To be specific, I need to do this in .net. regex can't identify some sentences ending with not so common punctuation, I am fine with it. I don't need 100% accuracy)
View 3 RepliesSay I have this list (with unknown delimiters):
ABC-12345, DEF-34567; WER-12312
ERT-23423
I know the regex to mach what I need is: [A-ZÆØÅ]{3}-d{5}. But how do I use the Group or Capture of the .net Match class?
This is my first attempt:
Public Function ParseSites(ByVal txt As String) As List(Of String)
Const SiteIdRegEx = "([A-ZÆØÅ]{3}-d{5})"
Dim list As New List(Of String)
[Code].....
I have found a Regex that test if the text passed to a TextBox is an email.
If Regex.IsMatch(email.Text, "^(?("")("".+?""@)|(([0-9a-zA-Z]((.(?!.))|[-!#$%&'*+/=?^`{}|~w])*)(?<=[0-9a-zA-Z])@))" + "(?([)([(d{1,3}.){3}d{1,3}])|(([0-9a-zA-Z][-w]*[0-9a-zA-Z].)+[a-zA-Z]{2,6}))$") _
[code]....
I'm using the following VB.net Code to find phone numbers in HTML and make them "clickable":
Regex.Replace(pDisp.Document.Body.innerHTML, "([0-9+ ]{3,6}[s]{1,1}[0123456789 -/]{4,15})", "<a href=http://DIAL/$1>$1</a>")
There appears an issue if the numbers contain white spaces, for example:
089 12233 455
This will be replaced with:
<a href=http://DIAL/089 12233 455>089 12233 455</a>
Is there a way to get
<a href=http://DIAL/08912233455>089 12233 455</a>
instead?
I have dates like the following (note trailing 'T')
2011-11-07T15:24:28
2011-11-07T
With regex i need to extract just the date part so both will look like this
20111107
20111107
.net Have a webservice that is returning a date like 2011-11-07T15:24:28, but on some occasions it returns date with no time but still with the trailing T. This causes .net's cdate function to bail out.
somebody put a regex expression that will:find a chunk that starts with [% and ends with %] within that chunk replace all xml special characters with:& quot; & apos; & lt; & gt; & amp;leave everything between <%= %> or <%# %> as is except make sure that there is space after <%# or <%= and before %> for example <%=Integer.MaxValue%> should become <%= Integer.MaxValue %>
source:[% 'test' <mtd:ddl id="asdf" runat="server"/> & <%= Integer.MaxValue% > %]
result:'test' <mtd:ddl id="asdf" runat="server"/> & <%= Integer.MaxValue %>