.net - Regex Replacing Non-words Chars In Strings, Ignoring Specific Chars?
Oct 8, 2011
In VB.net I've got the following line that removes all non-alphanumeric chars from a string:
return Regex.Replace(build, "[W]", "")
I now need to extend this to remove non-alphanumeric chars that aren't [] or _. I've changed the line to:
return Regex.Replace(build, "[W[]_]", "")
However I'm pretty sure that this says
replace non-word or [ or ] or _
how do I negate the tests for the [] and _ chars so that it says
replace non-word and not [ and not ] and not _
Some examples:
"[Foo Bar_123456]" => "[FooBar_123456]"
"[Foo Bar_123-456*]" => "[FooBar_123456]"
View 2 Replies
ADVERTISEMENT
May 5, 2009
I have text file with a row like this:
[Code]...
View 2 Replies
Nov 20, 2010
How to convert or make a cast of a List object typized as a container of chars like
Dim mylist As List(Of Char) = New List(Of Char)(New Char() {"1"c, "2"c})
in a simple array of chars as
Dim mychars() As Char
without make a loop for...
View 1 Replies
Nov 10, 2011
I'll explain the scenario. I have a list containing character list and it's corresponding unicode characters(copied from CharMap and pasted in VB editor).
For example:
Text = Unicode --> Unicode character
---------------------------------------
K = U+004A --> J
[code].....
View 2 Replies
Aug 4, 2010
I know I can use the Split function to split things, but that works with chars. I want to split pieces of text by a word, namely: [ CODE ] (without spaces) I tried entering that into the Split function but it would split [, not including CODE] Is there an other method to do that?
[Code]....
View 2 Replies
Jul 18, 2009
I wanna make a, lets call it encryptor... which will change letters in texbox1(abc) and put them in textbox2(123) for each a - 1 b -2 c -3...lets stop at tht...for each a in texbox1.text = 1 in textbox2
View 14 Replies
Feb 22, 2011
I have a 2d array of chars and i need to start at (0,0) and creat a string and check it against some value then still then add another char to the first one and check it. I need to do that in every direction.[code]say im at the H their are like 8 way i need to check..
View 1 Replies
Mar 21, 2011
I'd like to know if anyone has a code for or can direct me on how to select keywords given in a speech command and to ignore the other words. Example: Speech "The beach looks great today"
I want to use the word "beach" to trigger a function and ignore the rest of the speech.
View 2 Replies
Jun 10, 2012
I tried below code:
Private Sub txtName_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtName.KeyPress
' allow upper and lower case A-Z, and backspace
[Code]....
But it gives:
'KeyAscii' is not declared. It may be inaccessible due to its protection level.
how to allow alphabet only ?
View 4 Replies
Apr 4, 2011
I am making an antivirus program and i am having a problem with my database. how can i only get the hash in this string:
693248:ff807bd383d377f7f8f91ed4aa7677ae:Trojan.Agent-178374
i only want between the two ":"s in this string. how is this possible? and also how do i get the last part on the right of the last ":"?
View 3 Replies
May 16, 2009
ok here is the situation. i have a form that is hidden. the form needs to wait until somone hits the F2 button.
View 1 Replies
Nov 29, 2010
i have a csv file that needs to be imported to sql server the file includes Unicode characters, so i saved it in notepad as Unicode now when i run this in sql it works excellent BULK INSERT personimps FROM 'C:MyImp.csv' WITH (FIELDTERMINATOR = ',',datafiletype='widechar')but when using the following in my code-behind in asp.net, i get gibberish where the Unicode chars should be. [code] it seems like the oledbconnection is ignoring the extended properties, or maybe i didn't set up the connection-string correctly? the ASCII chars come out OK, the Unicode fields are just gibberish.
View 1 Replies
Jul 10, 2009
THis is a line of code i have, it's a code to go at the bottom of a document and the title of the question is the error it has, how do i change the 'Chars' to not be read only? I can only guess 'Chars' is a character.
pagecode(1) ="01274-6759q-DDD"
If you're not living on the edge, you're taking up too much room
View 1 Replies
Apr 12, 2009
let me show you my code first and then explain my problem.
[Code]...
View 2 Replies
Oct 29, 2009
I'm data binding to a label in a grid and need to knock off the last two chars, not so easy as I thought.I know this is wrong it just shows how I'm coding:
Code:Private Sub TemplateControl_DataBinding_Label(ByVal sender As Object, ByVal e As System.EventArgs)
[code].....
View 4 Replies
May 11, 2009
How can i replace the enter key with an other set of chars
example - text.replace(" ", "this is a space")
that previous statement will replace all spaces with the string "this is a space"
how do i do this for an enter?
View 1 Replies
Mar 11, 2010
Well I made another thread but I know how to make textbox allowed chars but is possible with web browsers? Like if f1 - f12 is pressed then nothing happen like nothing have been touch.
View 1 Replies
Oct 11, 2010
Well my question is simple and straightforward. Is there any way we can use hex values like in c++?
I am going to write binary files, but for that i will have to define certain characters like this for example.
x00x00x11x22x33x00x00. I would first need to convert stuff like this to a byte array, and then write it to a binary text file.
View 2 Replies
Apr 21, 2011
I was wondering if it was possible, in a console application, to write characters like "℃" using .NET? When I try to write this character, the console outputs a question mark.
View 2 Replies
Apr 16, 2011
Is there a way to let only certain chars be added to a datagridview cell? like '1234567890'?
View 1 Replies
Nov 30, 2010
It seems like I'm only able to enter a certain number of chars into a textbox.Like if I have a list from 1 to 10000.When I paste it in a textbox it ends like this:
5639
5640
5641
[code]....
Why cant I add everything to the textbox?
View 9 Replies
Dec 17, 2011
I get the Error Property 'Chars' is 'ReadOnly'
View 3 Replies
Mar 25, 2010
if the last 4 chars in my string(result) are " AND" or the last three chars are " OR" I would like to remove these from the string. So far I have am trying result.trimend and a few other methods but am unsure how to get it working.
View 3 Replies
Jul 7, 2010
I am using a masked text box to format phone numbers. However, I do not want the extra formatting that gets insterted from the masked text box: (800)-555-1212
All I want is: 8005551212
But I still want the user to type it in like this (to make it easier for user):
(800)-555-1212
I am thinking I can run a replace function on it, but I am not sure what event to use. I found a number of tutorials, but not that useful for what I am doing. [URL]
View 1 Replies
Nov 8, 2010
I solved this issue in this thread but there still are issues with special chars. ie 'I thought by doing parameters that it would take care of any special chars for you. Well i am still getting mysql exceptions about syntax. I look at the string it is working with and it has a "'" in it.Why are they not working as I expect them to?
View 7 Replies
Apr 29, 2010
I have a Textbox in which the user types in a name for a folder to be created. However, Windows does not allow the followin chars:
[Code]...
View 12 Replies
Feb 19, 2011
The file I need to read in is a square 8x8 or NxN. the chars are separated by spaces and at the end of the line I believe a crlf. When I try to read in the file i get the crlf's when i use this [Code]
View 1 Replies
Apr 14, 2010
this is driving me crazy , I have a string like this dim s as string = "<a href="url.aspx? target=_BLANK>mik, H</a>" I want to remove "mik, h" from the string, how can i do that?
View 4 Replies
Dec 6, 2009
Im trying to read encrypted text from a text file but when i try to read it i would get boxes in stead of the encrypted text.
View 1 Replies
Jan 5, 2011
I am trying to evaluate cells in Excel for invalid chars (I use them as lookups). They come from other sites so I need to quickly strip out bad chars (high ascii). I wrote a simple function that tries to loop through the positions of a cell starting from the end until it gets to the begining. It looks for the first ASCII char between 48 (ASCII for number 0) and 122 (lower case z). Everything else it would discard as junk and continue looping until it gets a good character. This will be the rightmost char to include so I could use a left(string, index) to extract valid data from a cell.
[Code]...
View 5 Replies