Skip to content

Commit

Permalink
feat: ✨ add feature #1
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideSegullo committed Apr 12, 2022
1 parent f97dae7 commit da5124d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions code/src/utils/address.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
export const searchValidAddress = (text: string, prefix = 'bitsong') => {
const regex = new RegExp(`${prefix}1[a-zA-Z0-9]{38}`, 'm');
const regex = new RegExp(`${prefix}1[a-zA-Z0-9]{38}`, 'gm');
let address: string;

let m: RegExpExecArray;

if ((m = regex.exec(text)) !== null) {
m.forEach((match) => {
address = match;
});
if (m.length === 1) {
m.forEach((match) => {
address = match;
});
}
}

return address;
Expand Down

0 comments on commit da5124d

Please sign in to comment.