473,547 Members | 2,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

regular expression question to remove blank spaces

Given this:

"[<][^>]*[>]"

the pattern to remove the htnl code between brackets, how can I remove a
series of spaces and just make one space.

like here is a series of blank spaces

thanks

Nov 12 '05 #1
1 4054
Danny wrote:
Given this:

"[<][^>]*[>]"

the pattern to remove the htnl code between brackets, how can I remove a
series of spaces and just make one space.

like here is a series of blank spaces

thanks


call like this
Dim strWOSpaces As STring
Dim s As STring
s = "like here is a series of blank spaces"
strWOSpaces = RemSpace(s)

Public Function RemSpace(strLin e As Variant) As String
Dim intFor As Integer
Dim strChar As String

For intFor = 1 To Len(strLine)
strChar = Mid(strLine, intFor, 1)
If strChar = Space(1) Then
Do While Mid(strLine, intFor, 1) = Space(1)
intFor = intFor + 1
Loop
intFor = intFor - 1
End If
RemSpace = RemSpace & strChar
Next
End Function

Nov 12 '05 #2

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

Similar topics

5
11724
by: Andrew Dixon - Depictions.net | last post by:
Hi Everyone. I have been working on some code that strips the HTML code out of an HTML page leaving just the text on the page. At the moment this is what I have: // Strip all tags replacePattern = "<(.|\n)+?>"; pageHTML = pageHTML.replaceAll(replacePattern,""); //Remove any HTML specific characters (e.g. &quot; or &amp;)
2
373
by: applemonster100 | last post by:
I have an xml string which I need to remove certain <error> node from. I can recognise the <error> nodes I want to delete from their attributes. For example, I need to replace the following with a blank string : <error errorid="11" itemid="10">The card name is mandatory.</error> I can't use a regular expression which matches the whole...
1
421
by: Danny | last post by:
Given this: "*" the pattern to remove the htnl code between brackets, how can I remove a series of spaces and just make one space. like here is a series of blank spaces thanks
4
5122
by: Buddy | last post by:
Can someone please show me how to create a regular expression to do the following My text is set to MyColumn{1, 100} Test I want a regular expression that sets the text to the following testMyColumn{1, 100}Test Basically I want the regular expression to add the word test infront of the
1
7394
by: Laser Lu | last post by:
Hi, all, I'm now writing a program to compress JavaScript code. One puzzle is how to write a regular expression to find out and remove all the redundent blank spaces. However, those blank spaces that are in the comments should be kept intact. I've tried to write some Regexs, and I list them here for your information: regex = new...
3
3202
by: James D. Marshall | last post by:
The issue at hand, I believe is my comprehension of using regular expression, specially to assist in replacing the expression with other text. using regular expression (\s*) my understanding is that this will one or more occurrences to replace all the white space between with a comma. This search ElseIf InStr(1, indivline, "$") Then insert...
17
11605
by: Randy Webb | last post by:
I know that the /g flag will match all occurrences. Is there a way, with a Regular Expression, to match all occurrences *except* the last one? pattern = /df/g; var myString = "asdfasdfasdfasdf"; var newString = myString.replace(pattern,'gh'); alert(newString) Gives me: asghasghasghasgh as it should. What I want: asghasghasghasdf Where...
25
5137
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART (CONDUCTION DEFECT) 37.33/2 HEART (CONDUCTION DEFECT) WITH CATHETER 37.34/2 " the expression is "HEART (CONDUCTION DEFECT)". How do I gain access...
6
12965
by: billsahiker | last post by:
I cannot get anything to validate a comma delimited list of stock symbols, like "IBM, MSFT,INTC). symbols are alphanumeric with a maxium length of 5. I want to block multiple, adjacent commas, and allow up to two blank spaces between symbols. The following did not work: (\w{1,5}(, *)?)*
0
7510
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7437
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7703
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7947
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7463
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6032
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3493
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
748
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.