INTERACT FORUM

Please login or register.

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

Author Topic: Capture text  (Read 319 times)

SkGe

  • Galactic Citizen
  • ****
  • Posts: 424
Capture text
« on: January 22, 2024, 12:54:17 pm »

it is possible to capture some contextual text from a description? An example is:
Code: [Select]
In 2015, Bergling released his second studio album, Stories, and in 2017 he released an EP, Avīci (01).[7] His catalog also included the singles "I Could Be the One" with Nicky Romero, "You Make Me", "X You", "Hey Brother", "Addicted to You", "The Days", "The Nights", "Waiting for Love", "Without You", and "Lonely Together". Bergling was nominated for a Grammy Award for his work on "Sunshine" with David Guetta in 2012[8] and "Levels" in 2013. Several music publications credit Bergling as among the DJs who ushered electronic music into Top 40 radio in the early 2010s..
Source wikipedia
I want to capture what inside those "You Make Me". I have one expression with replace() but everytime when it doesn't match with my replace() it doesn't count.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2422
Re: Capture text
« Reply #1 on: January 22, 2024, 01:14:32 pm »

Capture string within quotes?
regex([_text],/#"(.+?)"#/,-2)
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 424
Re: Capture text
« Reply #2 on: January 22, 2024, 01:22:25 pm »

@Zybex. This capture those text inside the "", which is good. But wow about if I want to keep those text captured text inside the description and let say give them a different color?
Ex:
In 2015, Bergling released his second studio album, Stories, and in 2017 he released an EP, Avīci (01).[7] His catalog also included the singles "I Could Be the One" with Nicky Romero, "You Make Me", "X You", "Hey Brother", "Addicted to You", "The Days", "The Nights", "Waiting for Love", "Without You", and "Lonely Together". Bergling was nominated for a Grammy Award for his work on "Sunshine" with David Guetta in 2012[8] and "Levels" in 2013. Several music publications credit Bergling as among the DJs who ushered electronic music into Top 40 radio in the early 2010s.
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 424
Re: Capture text
« Reply #3 on: January 22, 2024, 01:24:48 pm »

I'm experimenting with some expression, and so far I have something like:
Code: [Select]
replace(replace(replace(replace([wik artist description],regex([wik artist description], /#(\"\W\B)#/, 1),}),regex([wik artist description], /#(\s\")#/, 1),/ {),{,<b>),},<//b>)But the moment it match a space after" it messing all after.
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1971
Re: Capture text
« Reply #4 on: January 22, 2024, 02:31:42 pm »

One solution

just to my testing:
Code: [Select]
Save(/#In 2015, Bergling released his second studio album, Stories, and in 2017 he released an EP, Avīci (01).[7] His catalog also included the singles "I Could Be the One" with Nicky Romero, "You Make Me", "X You", "Hey Brother", "Addicted to You", "The Days", "The Nights", "Waiting for Love", "Without You", and "Lonely Together". Bergling was nominated for a Grammy Award for his work on "Sunshine" with David Guetta in 2012[8] and "Levels" in 2013. Several music publications credit Bergling as among the DJs who ushered electronic music into Top 40 radio in the early 2010s.#/, v_test)
[v_test]

actual expression. use [wik artist description] instead of [v_test]
Code: [Select]
Replace(Replace(ListMix(If(Math([N] % 2),[L1],"<font color="ff33ff">[L1]<//font>"),8,replace(Replace([v_test],;,__),",;)),;,/ ),__,;)
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 424
Re: Capture text
« Reply #5 on: January 22, 2024, 02:59:18 pm »

@Lepa 👍
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2422
Re: Capture text
« Reply #6 on: January 22, 2024, 03:04:16 pm »

Nice! I was playing with it and reached pretty much the same expression, just with a different separator than __ :)
The Compare() is not needed, as any expression that returns 1 will satisfy the IF condition:
If(Math([N] % 2),[L1], ...
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1971
Re: Capture text
« Reply #7 on: January 22, 2024, 03:21:59 pm »

Quote
The Compare() is not needed, as any expression that returns 1 will satisfy the IF condition:
Correct. Had some problems with listmix capture so put that there as safety when I was testing expression. probably that mode=8 wasn't somehow activated in the zelda at that time
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2422
Re: Capture text
« Reply #8 on: January 22, 2024, 03:24:47 pm »

One more Replace() to fix some spacing issues (Listmix removes spaces between elements):

Code: [Select]
replace(replace(replace(listmix(if(math([N]%2),[L1], "<font color="FF0000">[L1]<//font>"), 8, replace(replace([v_test],;,@@),",&&;&&)),;,),&&,),@@,;)
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1971
Re: Capture text
« Reply #9 on: January 22, 2024, 03:31:37 pm »

perfect!
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 424
Re: Capture text
« Reply #10 on: January 22, 2024, 03:33:37 pm »

Thanks guys :)

My old and probably obsolete expression it was... no where near to yours.
Code: [Select]
<font face="titillium web"size="95">trimlines(if(isempty([wik album description]),,trimlines(replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(listitem([wik album description], 0, /[ ), / 10"/ , / 10"/ ), / "..., {...), / 12"/ , / 12"/ ), /;", }/;), (/"', (/{'), / "', / {'), "//", {//}), :", }:), "/), }/)), "/, , }/,/ ), "/)/,, }/)/,),/)", }/)/ ), ";, }/;), /,", }/, ), "/., }/./ ), /.", }/. ), /"?, }/?), /"!, }/!), /!", }/!), "/ , }/ ), /";, }/;), /"-, }/-), "', }/'), /":, }/:), ", {), /(", (/{), (/", {), '/,"/ , '/,}/ ), / ",/ {), / (", / /{), "/), }/)), "/ , }/ ), 17} , 17"), 7} , 7"), 5'9}., 5'9".), "'s, {'s), {,<b>), }, <//b>), 12}, 12/"), <b>, <font color="2184C6">), <//b>, <//font> )
, 2)),1)<//font>
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1971
Re: Capture text
« Reply #11 on: January 22, 2024, 05:03:04 pm »

Use the last iteration from zybex to get rid of extra spaces after closing " in some cases
Logged
Pages: [1]   Go Up