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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:01:10+00:00 2026-05-24T07:01:10+00:00

I’m almost certain I already know the answer to this one, but my VBScript

  • 0

I’m almost certain I already know the answer to this one, but my VBScript is very rusty so I’m hoping to be proved wrong.

I am using a bespoke system that uses VBScript to evaluate validation on form fields. The problem is that the VBScript can only exist on one line and must return a boolean.

This is fine for checking string lengths and the existence of a specific string within a string, but I need to perform some regular expression checks.

So my question is, is there any way to condense the following to one line?

Set myRegExp = New RegExp
myRegExp.IgnoreCase = True
myRegExp.Global = True
myRegExp.Pattern = "^[\w\s]*$"
myRegExp.Test("Test St*ring")

The example would probably survive without the IgnoreCase and Global properties.

Thanks in advance,

Rich

  • 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-24T07:01:11+00:00Added an answer on May 24, 2026 at 7:01 am

    Depending on how this ‘bespoke system’ works:

    1. Use : to combine many statements on the line
    2. Add a function to the system’s code base and call it on the line
    3. Add a COM component (.wsc) to the system’s environment and call its .Validate method on the line

    POC for #3 – all you need is love – no I mean the ability to put a .wsc like:

    <?xml version="1.0"?>
    <component>
    <registration
        description="wsc trial"
        progid="Trial.WSC"
        version="1.00"
        classid="{F17637AC-48F0-4C02-9A88-D06741FFA58F}"
    >
    </registration>
    <public>
        <method name="vld">
            <PARAMETER name="sTxt"/>
        </method>
    </public><script language="VBScript">
    <![CDATA[
    Function vld( sTxt )
      Dim reVld : Set reVld = New RegExp
      reVld.IgnoreCase = True
      reVld.Global = True
      reVld.Pattern = "^[\w\s]*$"
      vld = reVld.Test( sTxt )
    End Function
    ]]>
    </script></component>
    

    on the computer and the line

    GetObject("script:<full path to\trial.wsc").vld( "Test St*ring" )
    

    in that one line. Test script:

    ' Assuming the 'bespoke system' evals the string you put on the line
    Dim aTests : aTests = Array( _
           "Set reVld = New RegExp : reVld.IgnoreCase = True : reVld.Global = True : reVld.Pattern = ""^[\w\s]*$"" : reVld.Test(""Test St*ring"")" _
         , "vld( ""Test St*ring"" )" _
         , "GetObject(""script:E:\trials\SoTrials\answers\6907380\vbs\trial.wsc"").vld( ""Test St*ring"" )" _
         , "GetObject(""script:E:\trials\SoTrials\answers\6907380\vbs\trial.wsc"").vld( ""nice data"" )" _
    )
    WScript.Echo String( 79, "-" )
    Dim sToEval
    For Each sToEval In aTests
        Dim vVld : vVld = "Bingo"
      On Error Resume Next
        vVld = Eval( sToEval )
        If 0 <> Err.Number Then vVld = Err.Description
      On Error GoTo 0
        WScript.Echo Join( Array( _
             "to eval: " & sToEval _
           , "result:  " & CStr( vVld ) _
           , String( 79, "-" ) _
        ), vbCrLf )
    Next   
    
    Function vld( sTxt )
      Dim reVld : Set reVld = New RegExp 
      reVld.IgnoreCase = True 
      reVld.Global = True 
      reVld.Pattern = "^[\w\s]*$" 
      vld = reVld.Test( sTxt ) 
    End Function
    

    output:

    cscript 6907380.vbs
    -------------------------------------------------------------------------------
    to eval: Set reVld = New RegExp : reVld.IgnoreCase = True : reVld.Global = True : reVld.Pattern = "^[\w\s]*$"
    : reVld.Test("Test St*ring")
    result:  Syntax error
    -------------------------------------------------------------------------------
    to eval: vld( "Test St*ring" )
    result:  False
    -------------------------------------------------------------------------------
    to eval: GetObject("script:E:\trials\SoTrials\answers\6907380\vbs\trial.wsc").vld( "Test St*ring" )
    result:  False
    -------------------------------------------------------------------------------
    to eval: GetObject("script:E:\trials\SoTrials\answers\6907380\vbs\trial.wsc").vld( "nice data" )
    result:  True
    -------------------------------------------------------------------------------
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.