Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6206305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:25:39+00:00 2026-05-24T05:25:39+00:00

I have : Dim Text = some text here ###MONTH-3### some text here ###MONTH-2###

  • 0

I have :

Dim Text = "some text here ###MONTH-3### some text here ###MONTH-2### some text here"
Dim regex = New System.Text.RegularExpressions.Regex("###MONTH[+-][0-9]###")
For Each match In regex.Matches(Text)
    // What to write here ?
    // So, that ###MONTH-i### gets replaced with getmonth(i)
    // Therefore, final Text will be :
    // Text = "some text here" + getmonth(-3) + "some text here" + getmonth(-2) + "some text here"
Next match

I think I have explained my problem properly..

So, can you please help ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:25:39+00:00Added an answer on May 24, 2026 at 5:25 am

    Here is what you want, I think.

    Dim text As String = "some text here ###MONTH-3### some text here ###MONTH-2### ..."
    Dim regex = New System.Text.RegularExpressions.Regex("###MONTH[+-][0-9]###")
    
    return regex.replace(text, AddressOf GetMonthFromMatch)
    
    Function GetMonthFromMatch(ByVal m As Match) As String
        ' Get the matched string.
        Dim matchText As String = m.ToString()
    
        Dim offset As Int = Integer.Parse(matchText.Right(2))
        Return getmonth(offset)
    End Function
    

    This uses the GetMonthFromMatch delegate to process each match and in turn call the getmonth function. The RegEx.Replace function will use the delegate to substitute each match.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried this... Dim myMatches As String() = System.Text.RegularExpressions.Regex.Split(postRow.Item(Post), \b\#\b) But it is
I have an app that is parsing the html page and extracts some text
Here is some code that I have that works perfectly: Sub EncryptFile(ByVal sInputFilename As
I have a simple text reading code for Visual Basic: Dim fileReader As String
I have this: Dim myTemp As String myTemp = System.DateTime.Now().ToString(MMMddyyyy_HHmmss) & .pdf System.IO.File.Copy(myFile, c:\
I have this code: Dim pathString As String = HttpContext.Current.Request.MapPath(Banking.mdb) Dim odbconBanking As New
This is the code I have: Sub Main() Dim dts As New DataSet Dim
I have see code like this Dim s as something = new something Dim
I have been working on some code that prints a textbox that lists contact
I have some pages that I want to save the PRINT version of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.