简体   繁体   中英

Regular expression

I have text from regular expression:

This post contains forecast for BTC/USDC This message was written by guest user, and is available at site.com

I need add with regular expression dot before like this: "BTC/USDC. This message" . How can i do that?

You can use String.prototype.replace() by providing a regex to find BTC/USDC and then return the string with the updated data using callback pattern

 var str= "This post contains forecast for BTC/USDC This message was written by guest user, and is available at site.com" const newStr= str.replace(/BTC\/USDC/, (match) => { return `${match}.`; }) console.log(newStr);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM