Regex - Regular Expression Needed To Replace Return Character With Another String?
Jul 20, 2009
I'm trying to replace all the carriage return characters in a string obtained from a multi line text box in a Windows Form with the string ", <BR>" so that when I use the string in some HTML it displays correctly.
Function Blah(ByVal strInput As String) As String
Dim rexCR As Object
rexCR = CreateObject("VBScript.RegExp")
I'm trying to replace all the carriage return characters in a string obtained from a multi line text box in a Windows Form with the string ", <BR>" so that when I use the string in some HTML it displays correctly.
Function Blah(ByVal strInput As String) As String Dim rexCR As Object rexCR = CreateObject("VBScript.RegExp")
I'm using Visual Basic 2010 Express to edit an XML file. I want to replace items that have (typically) non-zero floating point numbers with a single zero.
Ok - this may seem like a strange request ... but basically I need a regular expression to return a string in between two brackets as described below... String:
My coworker needs me to write him a regular expression for his vb.net app.I do not know vb and he does not know regex.The regex he needs is:/.*web id: ?(d+).*/iBasically he needs to search a string for something like "web id: 345" or "web id:2534" and retrieve the ID.He took what I gave him above and was able to put this together:
Dim strPattern As String = ".*web id: ?(d+).*" Dim strReplacement$ = "$1" GetWebId$ = Regex.Replace(LCase$(strNote$), strPattern$, strReplacement$)
I want regular expression validator for my telephone field in VB.net. Telephone format should be (+)xx-(0)xxxx-xxxxxx ext xxxx (Optional) example my number would appear as 44-7966-591739 Screen would be formatted to show +44-(0)7966-591739 ext?
I'm trying to type a regular expression that follows the following format: [URL] There are no special characters or numbers permitted for this criteria. I thought I had it down, but I'm a bit rusty with regular expressions and when I tested mine, it failed all across the boards. So far, my regular is expression is:
I'm trying to find the right RegEx to capture some (potentially) repeating data. I don't know how many times it will repeat. If I give an exanple of the data and what I want to capture can anyone point me in the right direction? It's the .Net regex engine (Visual Basic)
I need a regular expression that requires at least ONE digits and SIX maximum. I've worked out this, but neither of them seems to work. ^[0-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]?$ ^[0-999999]$
It seems up until now I've never used Regex, nor even heard of it. But once I did I realized how extremely useful this is. Having said, it's been 2 days since I've began looking into constructing my own patterns. My most recent being for decimals. Is the pattern I provided below "proper"? and are there also any improvements I could be making for a more efficient patter, which would minimize any possibility of a loophole? [code] So for my use, this is doing what it's supposed to being doing under every test I can through at it. But do mind the 0. and .0, I have a function to normalize these as they are proper, I just pad the left and right accordingly. I found most regex questions asked here..and yes I am doing this in vb.net so it fits. If not, then feel free to move this post somewhere else better suited for the topic of discussion.
This is a related to a previous question I have asked here, see the link below for a brief description as to why I am trying to do this.Regular expression from font to span (size and colour) and back (VB.NET).Basically I need a regex replace function (or if this can be done in pure VB then that's fine) to convert all ul tags in a string to textindent tags, with a different attribute value for the first textindent tag.For example:
<ul> <li>This is some text</li> <li>This is some more text</li>[code].....
Basically I want the first ul tag to have no indenting, but all nested ul tags to have an indent of 20.
I have written code to pull some data into a data table and do some data re-formatting. I need some help splitting some text into appropriate columns.
CASE 1
I have data formated like this that I need to split into 2 columns.
[Code]...
column is the first 11 characters That is easy.column 2 should contain all the text after the first 11 characters up to but not including the first number.The last column is all the text after column 2
I know it may be quite easily for you. i have a text which contains 40 lines, I want to remove lines which starts with a constant text. check below data.
When I used (?mn)[+CMGL:].*($) it removes the whole text , when I use (?mn)[+CMGL:].*( ) , it only leaves the first line. +CMGL: 0,1,,159 07910201956905F0440B910201532762F20008709021225282808 +CMGL: 1,1,,159
I am pretty good with perl regular expressions but evidently I am at a loss on why this doesn't work.The code below stores "Person Test" in output variable.
im output As String Dim userName As String = "Test, Person" Dim re As New Regex("(w+),s(w+)", RegexOptions.Singleline) output = re.Replace(userName, "$2 $1")
So why doesn't the following code store "#Test##Person#" in output variable.
Dim output As String Dim userName As String = "Test, Person" Dim re As New Regex("(w+),s(w+)") For Each Match As Match In re.Matches(userName) output &= "#" & Match.ToString & "#" Next
I am writing a hangman type game and I am displaying the word to the user in a label as all *'s, but I cannot figure out how to have just one of the *'s changed in the label to the correct letter when the user inputs the correct letter into the text box and clicks the check letter button.Everything else in the program works perfectly, except for this part.[code]When I use the .Replace it changes all of the *'s to the correct selected letter.
I'm trying to parse csv file with VB.NET.csv files contains value like 0,"1,2,3",4 which splits in 5 instead of 3. There are many examples with other languages in Stockoverflow but I can't implement it in VB.NET.Here is my code so far but it doesn't work...
Dim t As String() = Regex.Split(str(i), ",(?=([^""]*""[^""]*"")*[^""]*$)")
the coding is to 'Get input string and put its character into List, and replace the character with other.'but having problem putting each character into List and also replacing it,[code]
I want a regular expression for the following issue:I want to match a string that contains A,B,C,D,E and F. string length should be 0 to 6. and not character should be repeat in the string.Example: ABCDEF, ACDEFB, EFBCDA, etc. but not ABBCDES/W Engineer
I understand the concept of regular expressions but I am looking for a regular expression string that checks the input string for the following criteria only... 1.) Upper and lower case letters 2.) The space character 3.) Apostrophe 4.) Comma 5.) Period 6.) Hyphen
I am trying to use a regular expression to find a certain string within a textbox.
Is it possible to include the equals sign (=) within the regex so it looks for this? When i type the equals sign within the regex it doesn't fnid it any more.
Works when searching this string - "and JobID 816138</Detail>":
How do I make a regular expression to find a substring within a string that looks like: |sdrt446-7fdfs23| ? The number of characters and types change. So I need whatever in within the | |.