In my current project, I have extracted an XML response and converted it into readable text. Here is a snippet of the converted XML:
let XMLText = '<?xml version="1.0" encoding="utf-8"?>
<BlockList>
<CommittedBlocks>
<Block>
<Name>BlockId001</Name>
<Size>4194304</Size>
</Block>
<Block>
<Name>BlockId002</Name>
<Size>4194304</Size>
</Block>
</CommittedBlocks>
</BlockList>'
My current task involves locating and counting the occurrences of the value 4194304 within the text data.
While I attempted to use the search function, I encountered a limitation as it only provides the position of the specified string.
For example, the following function call returns 177, which represents the position of the string within the text:
XMLText.search("4194304")