473,395 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

RegularExpressions length.

This is the code for finding a text that is between "<" and ">":
Dim fileContents As String =
My.Computer.FileSystem.ReadAllText("c:/test.txt")
Dim RegularExpression As New
System.Text.RegularExpressions.Regex("<((.|\n)*?)> ")
Dim returnValue As String =
RegularExpression.Replace(fileContents, "<>").Trim
My.Computer.FileSystem.WriteAllText("c:/test.txt",
returnValue, False)

How to get the "regularexpression" length and if it's less 10
characters to replace it?
Example if:

<123456789to replace with <>
<1234567890123to do nothing
<12345to replace with <>
<123546789123456789do nothing

Thanks!
Jan 24 '08 #1
1 1387
alexvorn2 <al*******@gmail.comwrote in news:ca44e235-0237-45d7-a9eb-
d4**********@e25g2000prg.googlegroups.com:
This is the code for finding a text that is between "<" and ">":
Dim fileContents As String =
My.Computer.FileSystem.ReadAllText("c:/test.txt")
Dim RegularExpression As New
System.Text.RegularExpressions.Regex("<((.|\n)*?)> ")
Dim returnValue As String =
RegularExpression.Replace(fileContents, "<>").Trim
My.Computer.FileSystem.WriteAllText("c:/test.txt",
returnValue, False)

How to get the "regularexpression" length and if it's less 10
characters to replace it?
Example if:

<123456789to replace with <>
<1234567890123to do nothing
<12345to replace with <>
<123546789123456789do nothing
Try:

\<(\n{1,10})\>

I think this will find all matches <....with 1 to 10 numbers.

--
sp**********@rogers.com (Do not e-mail)
Jan 24 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mitchua | last post by:
Simplified a bit, I'm parsing HTML documents to get sentences e.g. my $html = get($URL); # remove all HTML TAGs...blah blah blah @sentences = split(/\./, $html)); then I'm trying to determine the...
2
by: Juan | last post by:
Hi, I´m using System.Text.RegularExpressions, I want to find any acurrence of the char & or % or | Ehat is the correct sintax for the Match method? This is what I´m usinf but is not working:...
5
by: Bill Yin | last post by:
I want get the Matchs <li>[xxxxxxxxxxxxxxxxxxxxxxxxx</li> begin:<li>[ end:</li>
2
by: Doug | last post by:
I'm a little confused by this functionality. It doesn't seem to be behaving like it should. I am using the following regular expression to validate email addresses:...
3
by: Gonçalo Boléo | last post by:
Can i validate a TextBox with a regular expression without using RegularExpressionValidator? Can i use a function to do this? I wan't to throw an error different from the way...
8
by: Richard Lionheart | last post by:
Hi All, I tried using RegEx, but the compiler barfed with "The type of namespace 'RegEx' could not be found. Prior to this, I had the same problem with MatchCollection, but discovered it's...
0
by: Neo The One | last post by:
I find some of the Regex classes are quite helpful for my learning. For example: System.Web.RegularExpressions.SimpleDirectiveRege...
3
by: Curious | last post by:
I have another question about Regular Expression. If I use: if (temp.Contains("Ending") == true) { temp = System.Text.RegularExpressions.Regex.Replace(temp, "Ending", "Beginning"); } It...
1
by: alexvorn2 | last post by:
This is the code for finding a text that is between "<" and ">": Dim fileContents As String = My.Computer.FileSystem.ReadAllText("c:/test.txt") Dim RegularExpression As New...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.