Regex to extract nth token of a string separated by pipes
问题 I'm new in Regex I need to count and extract tokens from the below sample text: AA||CCCCCCCC|||FFFFFFFFFFF Requesting 4th token I must get a empty '' string, requesting 6th I must get 'FFFFFFFFFFF' Would it be possible to have such regex? Thanks in Advance! PS: For token counting I've used '\|' adding +1 to the result is the string is not empty, surely there another more efficient way to do that using just a regex... 回答1: For DB2 please try this to get the 6th element in the list. This works