473,692 Members | 2,488 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

regExp Experts.....

hey,

I'm struggling trying to get the concepts of the regExp function down....

What i'm trying to achieve is to remove all white space from html formatted
source code.

I have the following regExp search string to remove all html source code but
that is not what i require..
RegExp.Pattern = "\<.*?\>"

I want to store all html source code and its text/image contents into a DB.

For that reason i want to remove all line breaks and spacing/tabs within the
source code so as to only have one exteremely long single line leaving the
formatting of the contents of the html code alone all so that i can stuff
into a varchar(MAX) field

thanks!!!
R
Jan 17 '07 #1
3 1557

"Russell" <Russell@_NOSPA M_artalacarte.c omwrote in message
news:um******** ******@TK2MSFTN GP03.phx.gbl...
hey,

I'm struggling trying to get the concepts of the regExp function down....

What i'm trying to achieve is to remove all white space from html
formatted
source code.

I have the following regExp search string to remove all html source code
but
that is not what i require..
RegExp.Pattern = "\<.*?\>"

I want to store all html source code and its text/image contents into a
DB.
>
For that reason i want to remove all line breaks and spacing/tabs within
the
source code so as to only have one exteremely long single line leaving the
formatting of the contents of the html code alone all so that i can stuff
into a varchar(MAX) field
Why is removing all this whitespace important?
Are you sure that all the whitespace is insignficant? there are times where
certain markup fails to render quite right when whitespace typically present
is removed.

Jan 17 '07 #2
I guess removing it is not that important and i am aware of how XML
whitespace is imoportant though for standard HTML. its nothing more than a
formatting language.

Would you happen to know of the regExp.Pattern string i should use?

"Anthony Jones" <An*@yadayadaya da.comwrote in message
news:uE******** ******@TK2MSFTN GP03.phx.gbl...
>
"Russell" <Russell@_NOSPA M_artalacarte.c omwrote in message
news:um******** ******@TK2MSFTN GP03.phx.gbl...
>hey,

I'm struggling trying to get the concepts of the regExp function down....

What i'm trying to achieve is to remove all white space from html
formatted
>source code.

I have the following regExp search string to remove all html source code
but
>that is not what i require..
RegExp.Patte rn = "\<.*?\>"

I want to store all html source code and its text/image contents into a
DB.
>>
For that reason i want to remove all line breaks and spacing/tabs within
the
>source code so as to only have one exteremely long single line leaving
the
formatting of the contents of the html code alone all so that i can stuff
into a varchar(MAX) field

Why is removing all this whitespace important?
Are you sure that all the whitespace is insignficant? there are times
where
certain markup fails to render quite right when whitespace typically
present
is removed.

Jan 17 '07 #3

"Russell" <Russell@_NOSPA M_artalacarte.c omwrote in message
news:eF******** ******@TK2MSFTN GP06.phx.gbl...
I guess removing it is not that important and i am aware of how XML
whitespace is imoportant though for standard HTML. its nothing more than a
formatting language.

Would you happen to know of the regExp.Pattern string i should use?
None that you can be sure 100% won't be causing a problem. However you can
be sure that storing the HTML with it's existing whitespace is 100% problem
free. What benefit is derived from this procedure do you get that is worth
the risk introduced into the system?


Jan 18 '07 #4

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

Similar topics

10
39351
by: Anand Pillai | last post by:
To search a word in a group of words, say a paragraph or a web page, would a string search or a regexp search be faster? The string search would of course be, if str.find(substr) != -1: domything() And the regexp search assuming no case restriction would be,
5
2353
by: Lukas Holcik | last post by:
Hi everyone! How can I simply search text for regexps (lets say <a href="(.*?)">(.*?)</a>) and save all URLs(1) and link contents(2) in a dictionary { name : URL}? In a single pass if it could. Or how can I replace the html &entities; in a string "blablabla&amp;blablabal&amp;balbalbal" with the chars they mean using re.sub? I found out they are stored in an dict . I though about this functionality:
0
1814
by: Chris Croughton | last post by:
I'm trying to use the EXSLT regexp package from http://www.exslt.org/regexp/functions/match/index.html (specifically the match function) with the libxml xltproc (which supports EXSLT), but whatever I do gets errors. The examples use namespace regExp, but the supplied files use regexp, I've got it so that it at least doesn't complain about namespaces but it then complains that it can't find the match function. My stylesheet is:
4
7470
by: Jon Maz | last post by:
Hi All, I want to strip the accents off characters in a string so that, for example, the (Spanish) word "práctico" comes out as "practico" - but ignoring case, so that "PRÁCTICO" comes out as "PRACTICO". What's the best way to do this? TIA,
26
2120
by: Matt Kruse | last post by:
Are there any current browsers that have Javascript support, but not RegExp support? For example, cell phone browsers, blackberrys, or other "minimal" browsers? I know that someone using Netscape 3 would fall into this category, for example, but that's not a realistic situation anymore. And if such a condition exists, then how do you guys handle validation using regular expressions, if the browser lacks them? For example:
7
3444
by: Csaba Gabor | last post by:
I need to come up with a function function regExpPos (text, re, parenNum) { ... } that will return the position within text of RegExp.$parenNum if there is a match, and -1 otherwise. For example: var re = /some(thing|or other)?.*(n(est)(?:ed)?.*(parens) )/ var text = "There were some nesting parens in the test"; alert (regExpPos (text, re, 3));
2
1562
by: CJM | last post by:
I'm trying to validate and input field that allows an integer or a single '*' character using regular expressions, but I'm not getting the results I'm expecting. I'm trying to match against the pattern "*|", which I hoped would translate to 'match against groups of the numbers (0-9) or against a single *'. However, it's matching against character 1 for each of the examples below when Global = False. When Global = True, it matches against...
6
2268
by: runsun pan | last post by:
Hi I am wondering why I couldn't get what I want in the following 3 cases of re: (A) var p=/(+-?+):(+)/g p.exec("style='font-size:12'") -- // expected
4
3902
by: Matt | last post by:
Hello all, I have just discovered (the long way) that using a RegExp object with the 'global' flag set produces inconsistent results when its test() method is executed. I realize that 'global' is not an appropriate modifier for the test() function - test() searches the entire string by default. However, I would expect it to degrade gracefully. Instead, I seem to be getting something as follows - using W3Schools handy page at :
0
8608
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8543
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9088
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7630
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5820
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4324
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2975
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.