Regular expression to exclude tag groups or match only (.*) in between tags

I am struggling with this regex for a while now.

I need to match the text which is in between the <ns3:OutputData> data</ns3:OutputData>.

  • Note: after nscould be 1 or 2 digits
  • Note: the data is in one line just as in the example
  • Note: the ... preceding and ending is just to mention there are more tags nested

My regex so far: (ns\d\d?:OutputData>)\b(.*)(\/\1)

Sample text:

...<ns3:OutputData>XlhBDQoNCl5GWCBUb3Agc2VjdGlvbiB3aXRoIGNvbXBhbnkgbG9nbywgbmFtZSBhbmQgYWRkcmVzcy4NCl5DRjAsNjANCl5GTzUwLDUwXkdCMTAwLDEwMCwxMDBeRlMNCl5GTzc1LDc1XkZSXkdCMTAwLDEwMCwxMDBeRlMNCl5GTzg4LDg4XkdCNTAsNTAsNTBeRlMNCl5GTzIyMCw1MF5GREludGVybmF0aW9uYWwgU2hpcHBpbmcsIEluYy5eRlMNCl5DRjAsNDANCl5GTzIyMCwxMDBeRkQxMDAwIFNoaXBwaW5nIExhbmVeRlMNCl5GTzIyMCwxMzVeRkRTaGVsYnl2aWxsZSBUTiAzODEwMl5GUw0KXkZPMjIwLDE3MF5GRFVuaXRlZCBTdGF0ZXMgKFVTQSleRlMNCl5GTzUwLDI1MF5HQjcwMCwxLDNeRlMNCg0KXkZYIFNlY29uZCBzZWN0aW9uIHdpdGggcmVjaXBpZW50IGFkZHJlc3MgYW5kIHBlcm1pdCBpbmZvcm1hdGlvbi4NCl5DRkEsMzANCl5GTzUwLDMwMF5GREpvaG4gRG9lXkZTDQpeRk81MCwzNDBeRkQxMDAgTWFpbiBTdHJlZXReRlMNCl5GTzUwLDM4MF5GRFNwcmluZ2ZpZWxkIFROIDM5MDIxXkZTDQpeRk81MCw0MjBeRkRVbml0ZWQgU3RhdGVzIChVU0EpXkZTDQpeQ0ZBLDE1DQpeRk82MDAsMzAwXkdCMTUwLDE1MCwzXkZTDQpeRk82MzgsMzQwXkZEUGVybWl0XkZTDQpeRk82MzgsMzkwXkZEMTIzNDU2XkZTDQpeRk81MCw1MDBeR0I3MDAsMSwzXkZTDQoNCl5GWCBUaGlyZCBzZWN0aW9uIHdpdGggYmFyY29kZS4NCl5CWTUsMiwyNzANCl5GTzE3NSw1NTBeQkNeRkQxMjM0NTY3ODkwXkZTDQoNCl5GWCBGb3VydGggc2VjdGlvbiAodGhlIHR3byBib3hlcyBvbiB0aGUgYm90dG9tKS4NCl5GTzUwLDkwMF5HQjcwMCwyNTAsM15GUw0KXkZPNDAwLDkwMF5HQjEsMjUwLDNeRlMNCl5DRjAsNDANCl5GTzEwMCw5NjBeRkRTaGlwcGluZyBDdHIuIFgzNEItMV5GUw0KXkZPMTAwLDEwMTBeRkRSRUYxIEYwMEI0N15GUw0KXkZPMTAwLDEwNjBeRkRSRUYyIEJMNEg4XkZTDQpeQ0YwLDE5MA0KXkZPNDg1LDk2NV5GRENBXkZTDQoNCl5YWg==</ns3:OutputData>... 

I have tried (?:ns\d\d?:OutputData>)\b(.*)(?:\/\1) in an attempt to exclude group 1 and 3.

I wan't to exclude the tags which are matched, as in the images:

  • Regular expression to exclude tag groups or match only (.*) in between tags

  • Regular expression to exclude tag groups or match only (.*) in between tags

Any help is much appreciated.

Replay

Category: regex Time: 2016-07-29 Views: 0
Tags: regex

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.146 (s). 12 q(s)