INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Regex() Help!  (Read 913 times)

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Regex() Help!
« on: June 27, 2019, 11:26:02 pm »

Hello.
Any wise mane can help me with a expression which include Regex(), because i can't understand how that is working and need to search for more info about it. Still searching but no ideea how to do that formula. Anyway i come to get any help if somebody has an ideea how to proceed.
My field is in this way:
Code: [Select]
2013-CD - HOLLYWOOD (1035665) : Stars Dance
2013-CD - Hollywood (8729502) : Stars Dance
2013-CD - Hollywood (8729667) : Stars Dance
2013-Enhanced CD - Hollywood (001805392) : Stars Dance
2013-Digital - Hollywood () : Stars Dance
2013-Digital - Hollywood () : Stars Dance [Amazon Exclusive]
2015-CD -  (5032456) : Stars Dance
And what i want to take info from there is the Album Label which in that field it says is "Hollywood".
Thank you!
Logged

Moe

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 718
  • Hi
Re: Regex() Help!
« Reply #1 on: June 28, 2019, 12:12:36 am »

I'm sorry, I am not sure what you're trying to get?

Do you want the number in parenthesis after Hollywood?

So you want to return

1035665
8729502
8729667
5032456

If so, this regex should work

Code: [Select]
regex([YOUR_FIELD_HERE], /#.*(?:Hollywood)*\((\d+)\)#/, -1)[R1]
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Regex() Help!
« Reply #2 on: June 28, 2019, 12:45:45 am »

Not exactly that from () which that is just the #catalog. Which i want is the label before the (#catalog).
Logged

Moe

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 718
  • Hi
Re: Regex() Help!
« Reply #3 on: June 28, 2019, 07:31:13 am »

If this is your input

Code: [Select]
2013-CD - HOLLYWOOD (1035665) : Stars Dance
2013-CD - Hollywood (8729502) : Stars Dance
2013-CD - Hollywood (8729667) : Stars Dance
2013-Enhanced CD - Hollywood (001805392) : Stars Dance
2013-Digital - Hollywood () : Stars Dance
2013-Digital - Hollywood () : Stars Dance [Amazon Exclusive]
2015-CD -  (5032456) : Stars Dance 

What do you want your output to be?  What’s your end goal?
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Regex() Help!
« Reply #4 on: June 28, 2019, 08:17:14 am »

So. What is my end for that expression is to just have only the label from that field. Here is another example from my fields
[2007-CD - Interscope (1734883) : Carry On] = [2007-CD -   Interscope  (1734883) : Carry On]
Where the info with line ignored and only the label to be shown. Hope now you understand my end of that expression.
Thanks


Logged

Moe

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 718
  • Hi
Re: Regex() Help!
« Reply #5 on: June 28, 2019, 08:27:17 am »

Try this

regex([YOUR_FIELD_HERE], /#.*\s-\s(.*)\s\(#/, -1)[R1]
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Regex() Help!
« Reply #6 on: June 28, 2019, 06:57:29 pm »

Is working. Thank you. Because of you now i start to learn some things on youtube maybe one day i will have a chance to do by myself :P
Logged

Moe

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 718
  • Hi
Re: Regex() Help!
« Reply #7 on: June 28, 2019, 10:49:38 pm »

If you're interested in learning more about Regex I suggest reading Brian's excellent introduction here https://yabb.jriver.com/interact/index.php?topic=97996.0

Also, this website is excellent for testing expressions https://regex101.com/r/uNDSUv/1/ (I pre-populated it with the regex provided in this thread)

Good luck!
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Regex() Help!
« Reply #8 on: July 01, 2019, 08:00:11 am »

@Moe
After i few hours reading and testing i finally achieve my target. From what you give me, and reading, for now i understand how to apply the regex() in MC, but still more to learn. Anyway thank you for the help, really grateful for this.
So testing that site and find a way to group the info from the field i achieve this:
Using album from Selena Gomez - Stars Dance
Field:
Code: [Select]
2013-CD - HOLLYWOOD (1035665) : Stars Dance
2013-CD - Hollywood (8729502) : Stars Dance
2013-CD - Hollywood (8729667) : Stars Dance
2013-Enhanced CD - Hollywood (001805392) : Stars Dance
2013-Digital - Hollywood () : Stars Dance
2013-Digital - Hollywood () : Stars Dance [Amazon Exclusive]
2015-CD -  (5032456) : Stars Dance
And the regex expression from that site is:
Code: [Select]
^(\d{4})\-(\D+)\s\-\s(\w*)\s\((\d*)Translate in MC:
Code: [Select]
regex([FIELD INFO],/#.(\d{4})\-(\D+)\s\-\s(\w*)\s\((\d*)#/,-1, 0)[R1] where R1=Year
regex([FIELD INFO],/#.(\d{4})\-(\D+)\s\-\s(\w*)\s\((\d*)#/,-1, 0)[R2] where R2=Format
regex([FIELD INFO],/#.(\d{4})\-(\D+)\s\-\s(\w*)\s\((\d*)#/,-1, 0)[R3] where R3=Label
regex([FIELD INFO],/#.(\d{4})\-(\D+)\s\-\s(\w*)\s\((\d*)#/,-1, 0)[R4] where R4=Catalog
Again, Thank You!
Logged
Pages: [1]   Go Up