473,396 Members | 1,655 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,396 software developers and data experts.

regular expressions replace

Hi
i'm trying to find a way using regular expressions to replace all the
[photoXXX] matches by an image

Exemple
[Photo123] by <img src="123.jpg">
[Photo25] by <img src="25.jpg">
and so on...

any one can help? ... thank you

Nov 19 '05 #1
3 1149
Hi John,

try this:

Regex.Replace(Str, "\[Photo(?<first>\d+)\]", " <img src="${first}.jpg">" ,
RegexOptions.IgnoreCase)
Alex
DotNet42.com - The Answer to Your .NET Question
"JohnZing" <jo*******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi
i'm trying to find a way using regular expressions to replace all the
[photoXXX] matches by an image

Exemple
[Photo123] by <img src="123.jpg">
[Photo25] by <img src="25.jpg">
and so on...

any one can help? ... thank you

Nov 19 '05 #2
Hi John,

try this:

Regex.Replace(Str, "\[Photo(?<first>\d+)\]", " <img src="${first}.jpg">" ,
RegexOptions.IgnoreCase)
Alex
DotNet42.com - The Answer to Your .NET Question
"JohnZing" <jo*******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi
i'm trying to find a way using regular expressions to replace all the
[photoXXX] matches by an image

Exemple
[Photo123] by <img src="123.jpg">
[Photo25] by <img src="25.jpg">
and so on...

any one can help? ... thank you


Nov 19 '05 #3
It works!
Thank You :)

Nov 19 '05 #4

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

Similar topics

1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
1
by: Graham Mattingley | last post by:
Hi, I have an issue where by when I use XMLHTTP to get data from another web site, all of the '£' symbols become '?'. I have try for hours to stop this happening but have been unsuccessful so...
3
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...
7
by: norton | last post by:
Hello, Does any one know how to extact the following text into 4 different groups(namely Date, Artist, Album and Quality)? - Artist - Album Artist - Album - Artist - Album - Artist -...
4
by: lucky | last post by:
hi there!! i'm looking for a code snipett wich help me to search some words into a particular string and replace with a perticular word. i got a huge data string in which searching traditional...
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
9
by: Pete Davis | last post by:
I'm using regular expressions to extract some data and some links from some web pages. I download the page and then I want to get a list of certain links. For building regular expressions, I use...
0
by: peridian | last post by:
Hi, I wanted a web page where I could post code to, and have it appear in coloured formatting based on the context of the code. Most of the techniques I have seen for this involve complex use...
1
by: NvrBst | last post by:
I want to use the .replace() method with the regular expression /^ %VAR % =,($|&)/. The following DOESN'T replace the "^default.aspx=,($|&)" regular expression with "":...
2
by: Stimp | last post by:
Hi all, I'm having trouble trying to figure out the best approach to this problem and I believe regular expressions are the way to go. Basically I have created a large string of XHTML using a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.