# Problem with stripping text

**URL:** <https://community.mp3tag.de/t/problem-with-stripping-text/18181>\
**Category:** Off-Topic\
**Created:** [August 17, 2016, 9:22am UTC](https://community.mp3tag.de/t/problem-with-stripping-text/18181 "2016-08-17T09:22:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjcm](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/9d8465/32.png) [@mjcm](https://community.mp3tag.de/u/mjcm)\
**Post date:** [August 17, 2016, 9:22am UTC](https://community.mp3tag.de/t/problem-with-stripping-text/18181/1 "2016-08-17T09:22:39Z")

</div>

I am writing a program in [VB.NET](http://VB.NET) (Personal Project) and need your guys help with Regex (or another solution), I have been thinking for a solution for days but I can't solve it.

A line which can looks like this (and maybe more)

> [@](#):
>
> "ABCDEFGHIJK ~ AB Ab Cdefgh"  
> "ABCDEFGHIJK AB Abcdefhijklmnopq"  
> "ABCDEF-GHIJKLMNO Abcdefgh"  
> "AB.CDEFGHIJKL Mnop"  
> "ABCD/EFGHIJ A abcdef"  
> "ABCD EFGH I Abcd efgh  
> "ABCD-EFGHIJ A abcdef"  
> "AB.CDEFGHIJ A abcdef"  
> "ABC-DEFGHIJ a Abcdef"

But I only want the 1st Part so

> [@](#):
>
> ABCDEFGHIJK  
> ABCDEFGHIJK  
> ABCDEF-GHIJKLMNO  
> AB.CDEFGHIJKL  
> ABCD/EFGHIJ  
> ABCD EFGH  
> ABCD-EFGHIJ  
> AB.CDEFGHIJ  
> ABC-DEFGHIJ

The only common standard about the format is that the text I want starts after a " chr(34) but after that there are (unfortunately) No more common identifiers (only that text I want is in ALL CAPS [A-Z] 😉

I can't seem to find a solution to this problem, the text file formatting is just to messed up and to do it manually would take me days and days (60.000 Lines)

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [August 18, 2016, 3:27am UTC](https://community.mp3tag.de/t/problem-with-stripping-text/18181/2 "2016-08-18T03:27:14Z")

</div>

> [@Mike\_nl](#):
>
> ... No more common identifiers...

In the examples, IMHO the blank is the common separator.  
So  
$regexp('ABCDEFGHIJK ~ AB Ab Cdefgh"',(._?) ._,$1)  
returns  
ABCDEFGHIJK

---

<div class="post-metadata">

**Author:** ![mjcm](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/9d8465/32.png) [@mjcm](https://community.mp3tag.de/u/mjcm)\
**Post date:** [August 18, 2016, 4:37am UTC](https://community.mp3tag.de/t/problem-with-stripping-text/18181/3 "2016-08-18T04:37:30Z")

</div>

Thanks for the Reply

But 1 thing.

That would fail if the text has a space in between. For example.

"ABCD EFGH I Abcd efgh

As I would like to get as Result ABCD EFGH

And the regex would only return ABCD

And in "the Regex Coach" the (.\*?) doesn't give any matches ☹

 ![](https://community.mp3tag.de/uploads/default/original/2X/e/e65d6a19cfc0d08dc9e039560c8e450d81786ac3.JPG)  

Edit: I came up with this (please don't laugh as I am ABSOLUTELY not a REGEX guy 😉 )

[A-Z]_(\s)?(-)?(/)?[A-Z]_

 ![](https://community.mp3tag.de/uploads/default/original/2X/5/545c101a3a4e4c3442a2bfe921e89e7ef147ff75.JPG)  

But that already fails if the text has Ü (Umlaut) in it 😉 or will with the text (as it grabs tooo Much)

ABCD EFGH I (and I only want ABCD EFGH)

 ![](https://community.mp3tag.de/uploads/default/original/2X/e/e65d6a19cfc0d08dc9e039560c8e450d81786ac3.JPG)  

 ![](https://community.mp3tag.de/uploads/default/original/2X/5/545c101a3a4e4c3442a2bfe921e89e7ef147ff75.JPG)

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [August 18, 2016, 5:08am UTC](https://community.mp3tag.de/t/problem-with-stripping-text/18181/4 "2016-08-18T05:08:23Z")

</div>

> [@Mike\_nl](#):
>
> Thanks for the Reply
> 
> But 1 thing.
> 
> That would fail if the text has a space in between. ...

That is true, but in your example none of the result examples has a string in it with a blank ... so I can only be as good as the example is.

Perhaps you have to go through the list twice:  
first cut all the bits in lower case, then deal with ones in mixed case.

This regexp will leave over anything that starts with capitals:  
$regexp('ABCD EFÜGH I Abcd efgh',(?-i)(\u._) ._,$1)

and this one  
$regexp('ABCD EFÜGH I Abcd efgh',(?-i)(\u._) \u\l._,$1)

chucks off all strings that start with a captital and continue with a lower case.

---

<div class="post-metadata">

**Author:** ![mjcm](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/9d8465/32.png) [@mjcm](https://community.mp3tag.de/u/mjcm)\
**Post date:** [August 18, 2016, 5:12am UTC](https://community.mp3tag.de/t/problem-with-stripping-text/18181/5 "2016-08-18T05:12:35Z")

</div>

> [@ohrenkino](#):
>
> That is true, but in your example none of the result examples has a string in it with a blank ... so I can only be as good as the example is.

Are you sure 😉 ???

Example line Nr 6

> [@](#):
>
> "ABCD EFGH I Abcd efgh

And I want as result

> [@](#):
>
> ABCD EFGH

Thanks again, will try those Regexes. Great help !!

Good one about stripping first the lower cases and then the mixed cases !!

Edit: I most certainly could do it manually, but this list changes sometimes once a week or sometimes twice and then a long while it doesn't change, so Id rather do it "semi auto"

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [August 18, 2016, 5:15am UTC](https://community.mp3tag.de/t/problem-with-stripping-text/18181/6 "2016-08-18T05:15:37Z")

</div>

> [@Mike\_nl](#):
>
> Are you sure 😉 ???  
> ...

Not any more ...
