0

I want to analyse line of string. There are some bytes as hex code. To this i want to get the first word after these without the characters "0x". The word after can contain a "x" but not as 0x. e.g.: TimeStamp[ID] -> 0x12 0x34 0x56 0x7 0x88 0x98 0x76 0x5 Word_I_Searched_without

I have proofed:

Regex excluding specific characters

Regex: Match word not containing

Regular expression to match a word without a character

Jules_96
  • 81
  • 8
  • 1
    what flavour? and also could you add some examples – IWHKYB Feb 13 '20 at 13:51
  • Please provide some input samples. Additionally, it might be easier to tackle the problem programwise (matching each word and analyze it then, that is). – Jan Feb 13 '20 at 13:53
  • e.g: TimeStamp[ID] -> 0x12 0x34 0x56 0x7 0x88 0x98 0x76 0x5 Word_I_Searched_without – Jules_96 Feb 13 '20 at 13:54
  • 1
    Please update your original post to include a sample input string and sample output from that string. – Gary_W Feb 13 '20 at 13:58
  • This > `(?<=\b0x)[0-9]+\b`? It's hard to tell what you are after without expected return. – JvdV Feb 13 '20 at 16:55

2 Answers2

0

The simplest would be to use a so called word boundary, if that is supported:

\b(?!0x)[0-9A-Fx]+\b

See a demo on regex101.com.

Jan
  • 42,290
  • 8
  • 54
  • 79
  • Thx for the answer. I test yours but you see [here](https://regex101.com/r/4FwE5V/3) it doesn't work unfortunately – Jules_96 Feb 13 '20 at 14:57
0

At least i changed my code. The result is that i used following regex with your input:

(?<=-> )(.*?)(\b(?!0x)(?!\s+)+.*)

Thanks for your help.

Jules_96
  • 81
  • 8