getAriaLabel.tsx 264 B

123456789
  1. export default function getAriaLabel(str: string) {
  2. const matches = str.match(/\[aria=(.*)\]/g);
  3. if (!matches) {
  4. return '';
  5. }
  6. const pre = matches[0];
  7. const start = pre.indexOf('aria="') + 6;
  8. return pre.substring(start, pre.indexOf('"]', start));
  9. }