Regex - Only Want To Change The Line
Jan 25, 2010
A string contains the following lines:
:61: C123456,1235AC
:81: hekljkjkjskdjfjafja;f
Bet. kenmerk 123456
I have code for regex.replace which is working.
The problem is that I only want to change the line: Bet. kenmerk 123456.
Not the lines which starts with :61: and :81:.
View 3 Replies
ADVERTISEMENT
Mar 14, 2012
Im trying to combine "contains" with a "Regex" and I just cannot get the right syntax down.
[Code].....
View 2 Replies
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
Apr 21, 2010
sTitle = Regex.Replace(sTitle, @"&w+;", "")
View 1 Replies
Jan 12, 2010
I have a vb.net class that cleans some html before emailing the results.
Here is a sample of some html I need to remove:
<div class="RemoveThis">
Blah blah blah<br />
Blah blah blah<br />
[Code]...
I am already using RegEx to do most of my work now. What would the RegEx expression look like to replace the block above with nothing?
I tried the following, but something is wrong:
'html has all of my text
html = Regex.Replace(html, "<div.*?class=""RemoveThis"">.*?</div>", "", RegexOptions.IgnoreCase)
View 2 Replies
Mar 23, 2012
give me a working regex expression (C#/VB.NET) that can remove single line comments from a SQL statement ?I mean these comments:
-- This is a comment
not those
/* this is a comment */
because I already can handle the star comments.I have a made a little parser that removes those comments when they are at the start of the line, but they can also be somewhere after code or worse, in a SQL-string 'hello --Test -- World' Those comments should also be removed (except those in a SQL string of course - if possible).Surprisingly I didn't got the regex working. I would have assumed the star comments to be more difficult, but actually, they aren't.
As per request, here my code to remove /**/-style comments (In order to have it ignore SQL-Style strings, you have to subsitute strings with a uniqueidentifier (i used 4 concated), then apply the comment-removal, then apply string-backsubstitution.
static string RemoveCstyleComments(string strInput)
{
string strPattern = @"/[*][wds]+[*]/";
//strPattern = @"/*.*?*/"; // Doesn't work
[code]....
View 3 Replies
Jan 5, 2011
I used to do a bit of coding in early versions of VB years ago but moved on to things like RPG400, CL and SQL on an AS/400 box. As I am no longer in this career, I havent touched an AS/400 for a while either.
I am currently working on a visual basic console application in Visual Studio 2005 which takes various csv files from an osCommerce web shop, processes them and writes the data to TAS Books accounts software with the aid of the Infoplex COM module.
I have 2 functions, one reads each line of a csv file into an array, and the second function uses Regex to split the lines array into the various fields before they are added to a structure.
There are something like 5000 records (lines) in the csv file, one example is as follows;
[Code]...
My problem is that due to the formatting of the product description in the example csv line above, it fails the Regex match and therefore fails to read.
I know this is because my pattern is wrong, but I'm not sure how to solve it, I think all I really need is for Regex to split the line by the "," between each element, this might be a little difficult because some of the descriptions contain both , and " but never one after the other.
View 3 Replies
Feb 18, 2010
defining an expression to capture the four numerics per line that define the lines on a map.
59.684 -4.251 59.575 -5.576
59.575 -5.576 59.437 -6.899
59.437 -6.899 59.27 -8.218
[Code]....
View 3 Replies
Jan 13, 2010
Yes, I've googled. But I must defer to the experts as time to study Regex is not available.
[Code]...
Can these 3 lines be condensed into one line? If so, how? The purpose is to remove all spaces before and after all occurrences of & in a string.
View 3 Replies
May 17, 2010
I'm having a slight issue and I've been Googling for ~3 hours now but to no avail like my other 2 questions of which the answer was obvious.t will probably be obvious again.Anyway, I want to colour everything after the String 'text2' in RichTextBox1 until the end of the line.'ve been playing around with it a bit but I couldn't get it to work.
Sub:
Private Sub ChangeColourOfWord(ByVal wordRE As String, ByVal Colour As Color, ByVal wordRE2 As String, ByVal Colour2 As Color)
[code]......
View 1 Replies
Sep 15, 2010
Still getting to grips with regex and have seen a few samples about that give me most of what I need so asking for opinion on this. I need to extract x words from a single line, so the regex could use w+ to get characters, however my line may contain anything inside the word like:
[Code]...
View 6 Replies
Oct 18, 2011
I am using a Formview for Change Password funciton in my project. It works OK with update and validations.I am now trying to add code for Strong Password as follows:
Private Sub FormView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewUpdateEventArgs) Handles FormView1.ItemUpdating
Dim password As String = CType(FormView1.FindControl("PasswordTextBox"), TextBox).Text
Dim score As PasswordScore = PasswordAdvisor.CheckStrength(password)
[Code]...
In the class, the Match.Success always returns "False" and also, irrespective of the validity of the password entered, it gets updated in the database. Is there any way to control the Update function of Formview, so that the password is updated only if it is valid?
View 1 Replies
Aug 23, 2010
This may take some explaining but the concept is pretty simple. A user will select a file which contains data that they wish to extract from, so keeping it simple they pick a file like so:
[Code]....
So, I need to show the user the file, allow them to select a line to match and/or extract from. So they select the first line ready for a match, they then select a word/s to mark as a constant for matching, so in this case it would be: MyGroup A simple version for text match would be like "MyGroup *" Now, I need to convert this to regex dynamically (I assume its the best method), its not a one off, the data that is selected is all open and up to user selection. There could be multiple selections and multiple extractions on the same line!
[Code]....
View 21 Replies
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
Feb 23, 2012
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>..
View 2 Replies
Feb 17, 2010
Is it possible to change PowerPacks.LineShape smoothingMode?I tried to use this code(a class that inherits LineShape):
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim g As Graphics = e.Graphics
' no difference when changing the SmoothingMode '
g.SmoothingMode = SmoothingMode.AntiAlias
[code]....
Result (don't take in consideration labels and circles):apparently smoothing mode is not taken inconsideration...
View 4 Replies
Dec 28, 2008
How do i change a line in a richtextbox?[code]...
View 4 Replies
Nov 17, 2011
how to change the shape of the end of the line
I would like to Cap type . Square, as here
View 9 Replies
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
Nov 17, 2011
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 Replies
Jun 15, 2009
is there a way to change the cursor position to the beginning of the another line in a richtextboxfor example, if i'm on the second line, i want code that will transport my cursor position to the beginning of the fourth line, etcfrustrated visual basic user
View 11 Replies
Apr 11, 2012
I have a text file with the format:
(title,price,id#)
CD1,11.00,111111
CD2,12.00,222222
CD3,13.00,333333
[Code]....
What is the best way to go change the price of the appropriate CD if I'm given the id# and new price?
I'm sure it has something do to with getting the line and splitting it, but I'm not sure how I edit just one line and not mess up the whole file.
View 3 Replies
Jun 4, 2011
I have a label on my code and i have 3 lines on it , what i want to do is to have my first line on white color and bold , next line normal white and third line on yellow normal ..
View 9 Replies
Sep 12, 2011
How can I change line color at run time? total 17 gridline showed in the graph, I only want to see 5 grid line and hide rest of gridlines when I use radar chart.
View 1 Replies
Dec 15, 2010
Is it possible to change the width of a line series with the chart bundled in .net 4?
View 3 Replies
Jan 8, 2010
Retrieving strings from a serial port with ReadLine works fine as long as the line ends with a linefeed chr$(10).However if no more strings are available to be read, Do Loop or For Next hang up waiting for the linefeed which never occurs.I believe using chr$(0) in place of linefeed would still work with strings ending with a linefeed..Just that the linefeed would be output.I have the complete MSDN Library.
View 2 Replies
Jun 23, 2010
I'm using in my winform project a RichTextBox control to display a kind of old console screen.This works perfectly but there is a space between the lines.Is it possible to change this space to be 0 or anything near that.If i paint a line from vetical line from line 1 to line 5 i don't want any spacing between the line.
View 2 Replies
Jan 14, 2012
I've got a listbox in visual basic 2008 with lines that look like:
item 0; item 1; item 2; item 3
How can I select that line and change within that line the value of e.g. item 3? (by default it's set to 0 and should be set to a value > 0 when entered by the user.
After that I need to calculate the total price based on the price in item 2 and the new value of item 3 (being >0)
View 5 Replies
Oct 26, 2011
Recently, I just helping my friend for developing game private server, in Game Client there are 3 application is needed, its is a patcher, launcher, and main exe, my friend use open source (C++ language) application for the patcher, the patcher is work nicely, and the launcher is program that launch main exe, its using launcher because main exe is need some argument to run, the launcher is created by me.The problem is the user can be run game directly without opening the patcher, so I want to change default command line (usually "0" / "1") in launcher to 3, and I have the trap if user open directly the launcher
If My.Application.CommandLineArgs.Item(0) = "3" Then
MsgBox("Please Run Patcher to proceed the game!")
End
[code]....
View 5 Replies
Apr 29, 2010
I have text file in c:, which called Hello.txt [code]...
View 7 Replies