VS 2008 - Regex Replace To Replace Double Quotes With Nothing?

Jul 13, 2009

I am trying to think of a regex replace to replace double quotes with nothing. Example:

hello("hi there") would become hello(hi there)

"hi" would become hi

"example "3" would become example "3

-edit Maybe an easier way to explain this is, replace all " that do not have a backslash before them.

View 6 Replies


ADVERTISEMENT

Replace Function With Double Quotes In From Part?

Jun 14, 2010

In vb.net how can i use replace function when the replace from part has double quotes in its value ?

View 1 Replies

Forms :: Replace Comma With Regex.Replace?

Mar 10, 2009

I am trying to filter out all unwanted characters from a string. All I want in the string is letters A-Z, numbers 0-9 as well as comma (,) plus (+) and quotes (").I figured how to do the letters and numbers, but the 3 special characters are giving me a problem. I also tried with the Chr(34) equivelant for the " sign, but no luck, as and " or , messes up the way the code is read. Here�s what I have so far, but it only works for A-Z and 0-9:

STR = System.Text.RegularExpressions.Regex.Replace(STR, "[^A-Z, 0-9, Chr(43) ]", "")

View 4 Replies

VB Regex But No Double Quotes?

Mar 20, 2011

i'm using regex to get some information from a website, i have this code:

Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://www.startkabel.nl/zoeken/index.php?zoek=" & TextBox1.Text)

[code].....

View 1 Replies

VS 2008 Regex Replace Upper Case?

Feb 4, 2010

For example, I want to match <Tag or <TAG and replace to <tag

Here's what I did(which obviously did not work): tmp = Regex.Replace(tmp, "<(.*)", LCase("$1"))

Just wondering what are some good ways to do this?

View 8 Replies

Concatenating A Variable With A Regex Group Match In Regex.replace?

Apr 5, 2012

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?

View 1 Replies

VS 2005 Display A Command Line Argument That Has Double Quotes Around, The Double Quotes Are Always Stripped Off?

Feb 23, 2010

If I try to display a command line argument that has double quotes around, the double quotes are always stripped off. How can I avoid this?

for example, the argument is "c:xx.txt" and this displays c:xx.txt instead Console.WriteLine((My.Application.CommandLineArgs(4)))

View 4 Replies

Increment Regex Match Using Regex.Replace

Jun 21, 2012

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]...

View 1 Replies

.net - Replace In Regex Match?

Mar 26, 2012

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?

View 3 Replies

Regex - Replace [b]xxx[/b] With 'xxx' In Bold

Nov 3, 2010

How can I convert [b]xxx[/b] to <strong>xxx</strong> using VB.NET Regex.Replace()?

View 2 Replies

Regex And Replace Function?

Jun 23, 2009

I have a text file like this

4.5 28 Red (T1 ) [1 12.86 53.8] 229111 -28275 198452 -1309 | 11.0 28 Red (2 13.10 04.0) [T1 ] 130611 2948 229111 28275
1.5 28 Blue (T2 ) [1 07.06 59.1] 191611 51225 190456 39339 |

[code].....

View 2 Replies

Regex.Replace Not Working?

Aug 15, 2011

I am trying to replace text in my xsl file. I have to replace all the http and https. But I can leave any links that start with <a href>

Ie; http://www.google.com has to replaced. But < a href="google.com">google.com</a> has to remain as it is.

I am using regex to find all the http(s) and a hrefs in the text. I am struck here.

My code is,

Dim href As New Regex("(<a.*?>.*?</a>)", RegexOptions.IgnoreCase)
Dim hrefs As New Regex("http(s)?://([w+?.w+])+([a-zA-Z0-9~!@#$\%^&*()_-=+\/?.:;',]*)?", RegexOptions.IgnoreCase)

[Code].....

I am trying to use Regex.Replace to replace my https. But I am unable to write the evaluate function.

My regex.replace replaces all the values with a single value.

View 4 Replies

RegularExpressions.Regex.Replace

Aug 20, 2009

System.Text.RegularExpressions.Regex.Replace(item.Summary.Text, ????, "")

What would I put in the? to get only the domain from a URL: EG [URL] should turn into "Google".

I don't know how the regex works to make it do that. Would it be like "*/*..*" or something?

View 8 Replies

VS 2010 RegEx Replace?

Sep 26, 2010

Dim ab As String = "aaaextBox1.Text = Regex.Replace(TextBox1.Text, "Dim " + ab + " As String", "aab")That is the code I am using now. Problem is that it's output is only "aab".Is there any way to keep the structure, so it would be "Dim aab As String" instead of only "aab"?

View 2 Replies

How To RegEx Replace Named Groups

Jul 27, 2009

I need to use RegEx.Replace to replace only certain named groups in my input string.

So I might have a pattern like:

"^(?<NoReplace>.+)(?<FirstPeriod>(d{2})|CM|RM|PM|CN|RN){1}(?<LastPeriod>(d{2})|CM|RM|PM|CN|RN){1}((#(?<NumberFormat>[#,.+-%0]+))*)$"

Tokens such as CM, RM are being replaced using Regex.Replace with a MatchEvaluator. However, this should only be replacing characters in the FirstPeriod and LastPeriod groups.

Example input:
"FIELDCNS 01CM"
Desired output:

[Code]....

Is this possible or am I best just pulling out the parts I want to replace and re-assembling afterwards?

View 5 Replies

REGEX Match With Math And Replace

Jun 3, 2011

I'm wanting to search a RTB for all X coordinate values and convert them to SI mm units.

I have two issues: 1. My code is stopping after the first instance of match.success, I'm guessing i'm using nextmatch incorrectly? I have also tried matchcollections with no success.

2. I fear once we get it progressing to the next X value, any multiple X values with the same dimension will be replaced with my replace command, causing the new value to be converted again.

Dim MatchObj As Match = Regex.Match(RichTextBox1.Text, "[Xx](?<X>(d*.{1,1}d{1,4}))(s)*")
If MatchObj.Success Then

[Code]....

View 11 Replies

Regex.Replace Formating A Query?

Nov 18, 2011

I am working in VB.Net and trying to use Regex.Replace to format a string I am using to query Sql. What Im going for is to cut out comments "--". I've found that in most cases the below works for what I need.

string = Regex.Replace(command, "--.*
", "")
and

[code].....

View 2 Replies

Regex.Replace With A String Of HTML

Jun 25, 2009

I have a long string of HTML code that contains several quotes around objects in the string. I have a Regex.Replace() function to change the "img src" tag, due to the way its stored in a database.

Here is my string: <p><strong><u><font color="#cc0099">RICH TEXT BOLD UNDERLINE. PICTURE TO APPEAR BELOW</font></u></strong></p><p><strong><u><font color="#cc0099"/></u></strong></p><p><img src="/inlineimages/WorkOrder/6/1245981403232.jpg"/> </p><p /><p>W00T!</p>

[Code].....

Notice how the "<font color=" has single quotes around its value, and "<img src=" has single quotes, with a double quote jammed in between?

Also, is there an automated way to go from my initial string, to the "Dim input As String" I created? I had to manually type that out, editing the quotes just to try and make it work.

View 6 Replies

Replace Line Breaks Using Regex?

Aug 23, 2011

How can I replace all types of line breaks (CR, LF and CrLf) using Regex?

I´ve tried different combinations of "
" and "
" but none finds them all.

formatedString = System.Text.RegularExpressions.Regex.Replace(text, "

", "[Exp 1]")

The following code does the job but it bugs my that I can´t seem to replace the Line Feed using Regexp.

[Code]....

View 3 Replies

Translate This C# Line For Doing A RegEx.replace To VB?

Apr 21, 2010

sTitle = Regex.Replace(sTitle, @"&w+;", "")

View 1 Replies

Replace The Double Quote In Net?

Mar 16, 2010

how can i replace the double quote in vb.net?

View 3 Replies

VS 2008 : Double Quotes Inside A Double Quote?

Apr 4, 2009

In vb.net, im using objWriter.Write("playerA= "x"")as you can see im using double quotes inside double quotes, how do i skip it so the error doesnt show up?in php you make an "" to skip the string like ("playerA = "x" ")

View 6 Replies

Regex - Regular Expression To Split By Comma + Ignores Comma Within Double Quotes?

Feb 7, 2012

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), ",(?=([^""]*""[^""]*"")*[^""]*$)")

View 2 Replies

.net - Replace Multiple Captured Groups In Regex?

Feb 9, 2012

VB2005: I've been looking at regex for some hours now and cant seem to get my head around the .Replace for my case. I'm looking for two fields and then I want to replace those fields with new values. So my string looks like so:

[Code]...

What do I put in MyRegexReplace? This is a simple two value replace but Im going to have possibly more so was thinking there has got to be a way to do this but need .

View 1 Replies

Calculate Inside Regex.replace Function?

May 21, 2010

I am trying to perform calculations on Regex substrings. I would like to do something like (see $2)

lblResult.Text = reg_exp.Replace(txtInput.Text, "$1" & "$2" * 0.039 & "$3" & "$4" & "$5")

I can only do this like:

For Each RxMatch In reg_exp.Matches(Me.txtInput.Text)
Me.lblResult.Text = Me.lblResult.Text & _
RxMatch.Groups.Item(1).ToString & _
Math.Round(CDbl(RxMatch.Groups.Item(2).ToString) * 0.03937, 4) & _

[code]....

View 3 Replies

Extract And Replace Named Group Regex?

Dec 29, 2010

I was able to extract href value of anchors in an html string. Now, what I want to achieve is extract the href value and replace this value with a new GUID. I need to return both the replaced html string and list of extracted href value and it's corresponding GUID.

My existing code is like:
Dim sPattern As String = "<a[^>]*hrefs*=s*((""(?<URL>[^""]*)"")|('(?<URL>[^']*)')|(?<URL>[^s]* ))"

[code]......

View 1 Replies

RegEx - Parse CSV File And Replace Certain Characters

Sep 2, 2010

I've used regular expressions in the past. I have an app that parses a .csv file and replaces certain characters (commas). Here's an example..
item1, item2, item3, fruits are apples, oranges, grapes. Squash is a vegetable, not a fruit.
What my app does is search each line between character1 and character18 and replace all "," with "~". How this is done through regular expressions?

View 2 Replies

Replace Characters Inside Parenthesis Using Regex?

Sep 30, 2010

To search a pattern containing parenthesis, they must be escaped using backslashes. So to search for (Streetname) you must use (Streetname). If you don't use , whatever is between () will be retained and available for reference through the variables $1, $2 etc... Exemple, in the sentence "It's worth noting that (StreetName) can be anything...(Post), (TreeStump)", $1=StreetName, $2=Post, $3=TreeStump

[Code]....

View 3 Replies

Replace Double Slashes In One Slash?

Oct 19, 2010

I need replace double slashes in one slash. I am planning do this in Global.asax Application_BeginRequest event. Is it enough? or better do a http module?

[Code]...

View 1 Replies

Regex - Replace Space In A String At Random Position In .net?

Mar 1, 2012

I want to select a random space in a string and replace it with a word (%word%) but there is a problem. The position cannot be fixed as i want it to be inserted at a random break. Few things which iam considering :

1)break the string at a space and merge it with the word

2) find a random space and replace it with the word. I like this point and so far all i have is break the selectedtext into string array and then iterate over each line. But i don't know how to find a random string position? Any short and sweet code please?

If (rtfArticle.SelectedText.Length > 0) Then
Dim strArray As String() = rtfArticle.SelectedText.Split(New Char() {ChrW(10)})
For Each str3 As String In strArray

[code]....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved