i want to use tesseract.js libaray to recognize a string like ("رقم العداد") and alert the number that is written after the string like (7038842 رقم العداد) << as you see i want to alert the number after the string from a png picture and copy another number from the picture ("نقطة الخدمة") this is what i have tried and it works fine if the [ text.match ] string was [القراءة] but if i change it to ("رقم العداد") or ("نقطة الخدمة") no alert pops up and gives me this error on console
Uncaught (in promise) TypeError: Cannot read properties of null (reading '1') at (index):25:63
code :-
Tesseract.recognize(
'Uff.png',
'ara',
{ logger: m => console.log(m) }
).then(({ data: { text } }) => {
var number = 'رقم العداد'; or /*'نقطة الخدمة'*/
var result = text.match(new RegExp(number + '\\s+(\\w+)'))[1];
alert(result);
})
</script>
