I have a string like this:
font-family:Arial;font-size:10px;color:green;
I would like to retrieve the string like this:
Arial;10px;green
How do I accomplish this ?
I have a string like this:
font-family:Arial;font-size:10px;color:green;
I would like to retrieve the string like this:
Arial;10px;green
How do I accomplish this ?
Do you use regular expressions or would string functions be better?
The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.
Hello,
Am I right in saying that you are parsing HTML that you are getting from "somewhere"?
If so, you might want to take a look at the HTMLAgilityPack:
http://htmlagilitypack.codeplex.com/
Which I am fairly sure has methods for getting at this data.
Gary
Remember to mark your thread as resolved. Remember to rate posts that help. Hitchhiker's Guide to Getting Help at VB Forums.
ASP.NET Tutorials (updated Feb 1st 2009) ASP.NET FAQs (updated July 17th 2011)
Free Stuff: WebsiteSpark|DreamSpark|BizSpark|eBooks
Learning Resources: MSDN|LearnVisualStudio|TrainingSpot|ScottGu's Blog|ASP.Net Starter Kits|Regex|RegExLib
Useful Tools: XPath Builder|UltraMon|RegExBuddy|CopySourceAsHtml|TracExplorer|SQLyog|Chart Controls for .Net|SharePoint Designer|CodeRush Express
Coding Links: XPath|ConnectionStrings|VB and MySQL|MySQL Connector.Net|My.Settings
ADO.Net: MSDN Reference|Introduction|Using Access|Always use Parameters|Save and Retrieve Data - jm|An Explanation - jm
Code Bank Submissions: Code Snippets|Profile Provider|Serialization: C# VB|Restricted Menu|Compressed HttpWebRequest|Enumerate and Add Internet Explorer Favourites: VB C#|C# Tabbed Web Browser|Enhanced Tabbed Web Browser: VB C#
My Blog - View my MCP Certifications
You can use Regular expressions for your purpose. This is possible both ways - javascript as well as server side asp.net code, since both support Regular experessions in one form or the other.
The following Regex expression will help get you the relevent parts:
Here's the strategy:Code:(?<=:).+?(?=;)
Use the regex expression I provided above to get the required parts. You will obviously get them in separate groups/sub-groups. All you need to do after that is to join/concatenate them with a semi-colon in between.
Let me know if you need some sample code and I'll try to quickly construct one.
Pradeep, Microsoft MVP (Visual Basic)
Please appreciate posts that have helped you by clickingicon on the left of the post.
![]()
"A problem well stated is a problem half solved." Charles F. Kettering
Read articles on My Blog 101 LINQ Samples JSON Validator XML Schema Validator "How Do I" videos on MSDN VB.NET and C# Comparison Good Coding Practices VBForums Reputation Saver String Enum Super Simple Tetris Game
![]()
![]()
NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...