Not sure what 'previous post' referred to. Reg ex "[0-9]+" (or equivalently "\d+") would match one or more integers.

Provided this is the first/only instance of the pattern, I would have thought that regex does provide the neatest solution, e.g.:

        put "(" & iNewNumber ")" into tReplacement
        put replaceText(tOldString , "\(\d+\)", tReplacement) into tNewString


On 26/04/2020 20:15, dunbarx--- via use-livecode wrote:
Pay no attention to the previous post, which only dealt with a single integer. 
Sloppy.
THIS old fashioned method works, though:
on mouseUpput offset("(",yourString) into startCharput offset(")", yourString) 
into endCharput random(999) into char (startChar + 1) to (endChar -1) of yourStringend mouseUp

Craig

-----Original Message-----
From: doc hawk via use-livecode <use-livecode@lists.runrev.com>
To: How to use LiveCode <use-livecode@lists.runrev.com>
Cc: doc hawk <doch...@gmail.com>
Sent: Sun, Apr 26, 2020 2:41 pm
Subject: Re: Wildcard? replaceText, offset?


On Apr 26, 2020, at 11:24 AM, Rick reasoned

In the middle-end part of the string I have “(x)” where x represents some 
integer.
it could be (4) or (10) or (5) etc.


If you’re certain that this is the only, or even the first, integer, a regular 
expression search and replace or [0-9]+  would  do the trick.

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to