To find bitcoin addresses in a string using regex in JavaScript, you can use the following regular expression pattern:
index.tsx37 chars2 lines
This pattern matches any string of characters that starts with either "1" or "3", followed by 25-34 letters and numbers (excluding "0", "O", "I", and "l"), which is the pattern for a typical bitcoin address.
Here's an example of how you can use this regex to find bitcoin addresses in a string:
index.tsx361 chars6 lines
In this example, the match()
function returns an array of all the matched strings in the given string. The output will contain all bitcoin addresses present in the string.
gistlibby LogSnag