@kaonaz Answered in PM
Parse string between left and right
-
This will make parsing simple
Let's say we have token in DOM like
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="msEe4mgFS1HgYTIVAGfjvtT2H/CGsOXXcdGJ83I82TDcVv8l9DUYGwxwsqUqErEulVEFCv0kzEdTH1VEqBCXxbPVIQ3zqQo98dws4zuB19g5ryXBIzjwfyHUBg7vTIgKJZNJU/BkZD/ntmZ/o5CG/IT4jfAzNSkAdKBQOGG7zeyqOS3qmgy9Cih+bUuWrEeMoT4p3iMEDoHsgUtaTaeDIpllVvfA7Mv3Eks3ebSKtAqnmDRZiy+j5VhkToGuFPxGoN5z0oNHUgROXtmGKc4Xhzph/CYvlUCqpjIQ5wc6Ym0mWhjjhc03UK6XGm0/YlDgST7++90UEkv0RD187eMaVV5fwxc9DVENB81U9YSz+EbLhFiKQ8506Ioxa7pV64JLp4kj9v/te9TdMV3DS5QVbGGwtiXyEMKmPpuQ0RXko918i3cyCduQQxWEu0ba60+ttqGrGfp+EK37lCcaq43iG335QMdAKa9ZgDkLvzdE8KdIttwfR6C8J0jZP/8q0YDegtf1ziJB7xbZ7Iz62Hdpvecgx5ubhBAUN2Rfx+C3Tf+qfGc4SbYS/o7tTugmA7OXku5bQm4KN+E0QaJc7LCr/Y2RfvpswPSO33uOU2lIPX70qZwkuSIrEhppsYnm7SOYrah2ITdibNbZQL1MXubC5gwqBogn5txNwrhqC8rjedvs6whW2RI67bhvRq7126ARF4BAxjiUeYGwWnjhZ95eOcSLltaY83sseKziLEXLw8fF3rMKOAWa7qPtMBtYVY3b3QL6pU66Hp0YAftxQz81njpugQeB9+5M5EHGn+OdOA45AJdw21szirTagminC1vvwHByLp9/fYhDNDiGJMYRss8qosJ/bM91nLcIkIJ3FhHKk/e7xYLbXGxSWLuWci6LFuODykq4KUGVA8gHeCRu7ATZ76cRVDLk/u7sFKc1gtLbQOxkuvDSWhr3wgBVbodUI2/8fYBJ22Bo9J2/6INX9ATKNXogyf6LPW5A8c2DzjZvEBc0hJGTsH+qMu9TBhntEcGMQZv+yLFb85ZGvb0SrsKoLVf15uJBVGgiffnbMWrLLQ1WjpAAQT3q+OuYd9lvjtnkiFay5mKp3qcWoosjz9dZWzemff2ladMvr8p+ZK2xk2q2nKrqZgOgm10VAb2ByshFZSq2LJdgb7zp7nfeLRXrPam68jHKAxA9qTH7QpehT65YKDscxvIGz/elTVUgW3YVDeoV66ffBR0PvtihCt6NkNWYQFVkTnpQPv/c7C2bIBEPlVBjolq0SGTo0g0Rzv9QTKUvnp9xWy0AcgRIFo6/ePY=" />Idea is to put starting and ending text and parse text between so in this case left starting will be
name="__VIEWSTATE" id="__VIEWSTATE" value="and right
"This must give us token :)
-
@GhostZ said in Parse string between left and right:
@gudolik, Just use XPath to get attribute "value".
Example:
//input[contains(@name, 'VIEWSTATE')]/@valueReturns empty already tried that, must use regex to get as xpath returns empty. But this is just a suggestion to make things easier not an issue
-
@gudolik said in Parse string between left and right:
@GhostZ said in Parse string between left and right:
@gudolik, Just use XPath to get attribute "value".
Example:
//input[contains(@name, 'VIEWSTATE')]/@valueReturns empty already tried that, must use regex to get as xpath returns empty. But this is just a suggestion to make things easier not an issue
What you described is easily accomplished using regular expressions, without an additional tool
https://regex101.com/r/LBhoEi/1

But @GhostZ said the right solution. For parsing html pages it is better to use xpath. If the specified solution does not work for you, show where and how you apply it.