VS 2008 String IndexOf And Remove VS Regex?
Oct 11, 2009
I have a string with 60000+ characters. I look for informations inside the string in a sequentially order. Every time I found a information I delete whatever is behind that information. In other words I reduce the size of the string every time I find something, and I do this using IndexOf and Remove, much like this:
vb.net Str = Str.Remove(0, Str.IndexOf("MyInfo"))
This can be quite heavy on the processor. So my question is it faster to look the informations using Regex or it would be about the same?
View 5 Replies
ADVERTISEMENT
Jan 13, 2012
I'm sorry if it's a duplicate of some question but this is specific on Vb.Net Regex function.
I need to remove any occurrence of 3 or more duplicate characters on a given string. For example:
Dim strTmp As String = "111111.......222222 and 33"
Dim output As String = Regex.Replace(strTmp, "????", "")
Debug.Print(output)
The "????" part I guess should be the Regex expression, which I must assume I know almost nothing about.
I don't know if that's the correct syntax. But I need the output to come as:
"1.2 and 33"
View 1 Replies
Feb 21, 2009
I have a string array in the form [code] The above obviously doesn't work since it's an array. Is there a similar method for the string array.
View 1 Replies
Sep 8, 2010
How would I find the index of an item in the a string array following code:
Dim arrayofitems() as String
Dim itemindex as UInteger
itemindex = arrayofitems.IndexOf("item test")
Dim itemname as String = arrayofitems(itemindex)
I'd like to know how I would find the index of an item in a string array. (All of the items are lowercase, so case shouldn't matter.)
View 3 Replies
Aug 7, 2009
I'm here again asking stupid questions. I don't have really get this but i ask again but i try explain all better. Here is a website link and i want catch string from here. Look page's source code and find first what starts <td> someword </td> I use this code for catch word from page. Visual Basic Express 2008
[Code]...
View 8 Replies
Jul 28, 2009
What would be the simplest way to find the n-th position of delimiter in a string.For example, say, I have a string variable called FullFilePath that contains the path of a file, like, C:SourceFiles<mthyr><subject><filename>.txt From this, I would like to extract out mthyr, subject, and filename, using the delimiter, "".
I was hoping string.IndexOf would let me find the n-th position of the delimiter "", in which case I can use the result to do a string.Substring. But it looks like IndexOf only finds the first occurence of a certain string, which means I would have to interate this somehow to look for the n-th occurence.
Or is there another method that will help me do this more efficiently.
View 2 Replies
Jun 30, 2009
i want index of the first value in a string Without calling IndexOf.
Like, " I am going" and my search value is "am"
so it should give me index value as "2".
View 8 Replies
Oct 27, 2010
[code] How to substring only the line(s) below the explanation e.g. No match for "VBFORUMSBLAHBLAH.COM". Everything else should be ignored.
View 10 Replies
Mar 12, 2010
#@$#^@ 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
View 6 Replies
Feb 11, 2010
I am using this regex string in one of my programs to validate email adresses: "^[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,4}$". This works well for the most part, but I just found out that it doesn't catch an address like this ... "john.doe.@yahoo.com" ... where there's a "." right before the "@", which is invalid, so my program tries to send it & throws an exception. How to modify my regex string to catch this situation?
View 4 Replies
Apr 20, 2011
I have a string like this
<li>something is here</li>
but it should be <li>something is here</li>
View 3 Replies
Mar 9, 2011
I need to remove all quotes from an image tag found within lots of other text. For example, I want to make
<img src="folder/image.gif" target="_blank" />
into
<img src=folder/image.gif target=_blank />
I'm using vb, and need to use a regEx specifically for the img tag and not use replace. The img tag can be in a block of other text, so I need to use regEx to search for the <img and then within that until I meet a /> I need to remove all quotes.
View 5 Replies
Feb 29, 2012
It's the same with how to remove double white space using regexp
View 3 Replies
Apr 14, 2012
Currently I have this code in my app:
Dim parts As New List(Of String)(ListBox2.SelectedItem.ToString.Split(""c))
Dim myArr(1) As String
myArr(0) = parts(0)
parts.RemoveAt(0)
myArr(1) = String.Join("", parts.ToArray)
MsgBox(myArr(1))
MsgBox(myArr(0))
As you can see it splits from left to right.Can anyone help me update the code to read the string RIGHT to LEFT and remove everything read till it finds the FIRST "" and display in msgbox?
View 4 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
Apr 27, 2012
I have to process a string that could include all sorts of non-standard characters and I've been asked to provide a regular expression that will match and remove all characters that are non-alphanumeric except punctuation and spaces. Is there a way to do this?
View 3 Replies
Mar 21, 2012
I wan't a Regex to remove all html tags with NO data between them...
sofar i have got:
"<span(s[^<]+?)?>([s
]+?)?</span(s[^<]+?)?>"
but this will obviously only work for all span tags ... how can i make it work for ALL tags?
View 13 Replies
Mar 18, 2009
I have this text:
[Code]...
How to remove '; (anything):' and replace it with a single comma? I am sure RegEx can do it...
View 4 Replies
Sep 14, 2010
I need to remove some content from string.
dim id as string ="TabContainerContent1_Basic_MyFirstName"
I need to remove TabContainerContent1_Basic_ . The fix is TabContainerContent1, it is under loop so always _Basic_MyFirstName will be changing. I need to get the text after the last _ char.
View 2 Replies
Dec 28, 2009
How would I remove before a string e.g. If I wanted to removed before "the" in "this is the test" it would leave me with test.
View 5 Replies
Aug 14, 2010
i have a string like this sravani/i want to remove last character '/' in the above string...which function can i use?
View 3 Replies
May 9, 2011
I have the following string [custID] = 'A99999999' I am trying the following to remove the square brackets and the single quotes Regex.Replace(sql, "/[[]']+/g", " ") but that's not working. I keep getting the same results Note: sql is a variable holding the string above. I want the result to be
View 5 Replies
Mar 24, 2012
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
[Code]...
View 1 Replies
Jan 13, 2010
I am reading the following text from a multiline textbox
james:johnson
anita:baker
vince:daly
chuck:better
I want to remove the newline characters on line 2, 3, 4 etc.
Dim AccountsText As String
Dim arr_Accounts As String()
AccountsText = txt_Accounts.Text
[Code].....
View 5 Replies
Sep 1, 2011
i have a listbox that adds the contents of a file to listbox1, this works fine. The list is a list of customer email then name like: [URL]:Peter it adds it like above to the list with the below code using regex VB
[Code]...
View 4 Replies
Oct 8, 2010
i need to togglie selection form a string in a rich text box and put careet one space forward.
View 1 Replies
Mar 15, 2009
We know that VB string start and end with double quotes " "
So we have to use "" if we want " in VB string.
I wonder if there is a regular expression pattern which will match VB string?.
View 2 Replies
Sep 10, 2011
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]...
View 2 Replies
Jun 28, 2010
I am a vb newbie having some trouble with an assignment. A user enters a letter into a text box, and the output must make the letter uppercase and tell what position the letter is at in the sentence "The quick brown fox jumps over a lazy dog."
Here is my
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
[CODE]...............
This is what comes out: "A first occurs in position -1". Everything comes out except the position is always displayed as -1.
View 4 Replies
Aug 11, 2010
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="">).+(?="")
View 5 Replies