TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tamal Banerjee
NA
25
3.3k
Compiling multiple regex replaces in vb.net?
Aug 22 2016 11:39 AM
Is it possible to compile different regex replaces in vb.net? For example, I want to do the below replaces and that code that I have written is :
Dim pattern1 As String = "(figure|fig\.) (\d+)"
Dim pattern2 As String = "(table|tabl\.|tab\.) (\d+)"
Dim pattern3 As String = "(section|sect\.) (\d+)"
Dim pattern4 As String = "<disp-formula id=""deqn(\d+)"
Dim rep1 As String = "<xref ref-type=""figure"" rid= ""fig$2"">$1 $2</a>"
Dim rep2 As String = "<xref ref-type=""table"" rid= ""tab$2"">$1 $2</a>"
Dim rep3 As String = "<xref ref-type=""section"" rid= ""sec$2"">$1 $2</a>"
Dim rep4 As String = "\r\n<disp-formula id=""deqn$1"
Dim rgx1 As New Regex(pattern1, RegexOptions.IgnoreCase)
Dim rgx2 As New Regex(pattern2, RegexOptions.IgnoreCase)
Dim rgx3 As New Regex(pattern3, RegexOptions.IgnoreCase)
Dim rgx4 As New Regex(pattern4, RegexOptions.IgnoreCase)
Dim result1 As String = rgx1.Replace(input(x), rep1)
Dim result2 As String = rgx2.Replace(result1, rep2)
Dim result3 As String = rgx3.Replace(result2, rep3)
Dim result4 As String = rgx4.Replace(result3, rep4)
input = result4
How do I compile all this replaces to a single or much less lengthy coding?
Reply
Answers (
1
)
how to get the exact next date from a given date in c#
Change values of list in list<list>