I am trying to find occurrences of a particular pattern in a string and have written the regex for the same. But the output is different when using different method in haskell. Pasting a sample for reference
Regex
<nARD>([a-zA-Z0-9?=-]*)</nARD>
Input String
<a> <b> <nARD>abcd</nARD> </c> <nARD>pqrs</nARD>
Expected Output
["abcd","pqrs"]
Current Output when using (getAllTextMatches (fileData =~ "<nARD>([a-zA-Z0-9?=-]*)</nARD>") :: [String])
operator
["<nARD>abcd</nARD>","<nARD>pqrs</nARD>"]
Current output when using matchRegex
function
matchRegex (mkRegex "<nARD>([a-zA-Z0-9?=-]*)</nARD>") "<a> <b> <nARD>abcd</nARD> </c> <nARD>pqrs</nARD>"
Output
Just ["abcd"]
but expected output is Just ["abcd","pqrs"]