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 8492735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:48:33+00:00 2026-06-10T22:48:33+00:00

First of all, I am not from programming background and totally new to VB.

  • 0

First of all, I am not from programming background and totally new to VB. For some reasons, I have to do a small scripting task at office.

I have gone through many posts here as well on other forums but not able to find the required information.

Ok so here’s what I need to do:

I want to find an integer from a string (the integer can be any from 5 to 4095) and replace it with an integer of my choice.

I have done some analysis but not able to find a function which can search for “any” integer from a string. Searching for fixed integers is working fine.

e.g:

Convert: “There are 10 apples” – where 10 can be any number from 5 to 4095, not known to me.

To: “There are 5 apples” – 5 is the number I will manually give.

Any help is appreciated.

Thank you.

Edit

Final Code:

Set objFSO = CreateObject("Scripting.FileSystemObject") 
strFile = "C:\Users\inkasap\Desktop\temp\IOParams_Backup.xml" 
Set objFile = objFSO.OpenTextFile(strFile) 
Do Until objFile.AtEndOfStream strLine = objFile.ReadLine 
    Dim re, strLine 
    Set re = New RegExp 
    if InStr(strLine,"name=""BIOSCUPP") > 0 Then 
        re.Pattern = "\d+" 
        Set colMatch = re.Execute(strLine) 
        For Each objMatch In colMatch 
           strLine = Replace(strLine, objMatch.Value, "30") 
        Next end 
    if WScript.Echo strLine 
Loop
  • 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-06-10T22:48:34+00:00Added an answer on June 10, 2026 at 10:48 pm

    Well, you can use regular expressions to find any numerical value, and then replace it:

    Dim re, test
    Set re = New RegExp
    re.Pattern = "\d+"
    
    test = "There are 4000 apples"
    
    Set colMatch = re.Execute(test)
    For Each objMatch In colMatch
        MsgBox(Replace(test,objMatch.Value,"5"))
    Next 
    

    enter image description here

    This page contains all informations you need.

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

Sidebar

Related Questions

First of all, I am not from programming background and totally new to VBscript.
First of all: This question is not directly programming related. However, the problem only
I have long programming background, but am new to Python, and am playing around
First of all,I'm not into web programming. I bumped into django and read a
First of all I have to admit that my programming skills are pretty limited
This is only a half-way programming question. First of all I have a PCI-Express
So, first of all, I'm really kinda new to programming in general (I'm a
First of all: I am not able to find out the proper Title of
first of all: this is not the same as this . The ModelBackend has
First of all I'm not sure this is even possible, however I need to

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.