non capital

Hi There,

I would like to keep the non capitol words from the first Line the regexpr encounter.

POP ROCK, CORPORATE,
MID,peaceful, Reflection, landscape, 
MEDIUM,calme, Reflexion, landscape, 

would become
peaceful, Reflection, landscape

Field: MOOD
Regular Expression: [a-z].*
Replace matches with: $1
[x] case sensitive

Did the opposite which is useful to fill my Genre Tag

Any Thoughts?
Guy Forssman

$regexp(%MOOD%,'\b[\u\s]+\b,\s',) From: "POP ROCK, CORPORATE, MID, peaceful, Reflection, landscape, MEDIUM, calme, Reflexion, landscape" To: "peaceful, Reflection, landscape, calme, Reflexion, landscape"

DD.20140716.1919.CEST

Hi There,

Thank you very much for the quick answer. I did the following:

Field: MOOD 
Regular Expression:\b[\u\s]+\b,\s
Replace matches with: $1
[x] case sensitive

It indeed does the job but not in all cases

For example

will result in

Do you have any improvments?

Thanks for cooping with me,
Guy Forssman

$regexp(%MOOD%,'\b[\u\s/]+\b,\s',) From: "POP ROCK, CORPORATE, MID, peaceful, Reflection, landscape, MEDIUM, calme, Reflexion, landscape, LOW/ UP, drama, LENT / RAPIDE, drama" To: "peaceful, Reflection, landscape, calme, Reflexion, landscape, drama, drama"

DD.20140718.1057.CEST

Hi Thanks again ,

From:
CORPORATE,
LOW/ UP, drama
LENT / RAPIDE, drama

To:
dramadrama , is disappeared

From:
ETHNO POP - ETHNIC POP,
MID ,arabazing, lanscape, walk, sharing,
MEDIUM,arabisant, paysage, partage, marche,

To:
ETHNO POP -
MID ,arabazing, lanscape, walk, sharing,
MEDIUM,arabisant, paysage, partage, marche,

Is it possible to tweak it even further?
Kind Regards
Guy Forssman

There has nothing disappeared, there is only the lack of one comma behind the given item.

DD.20140718.1150.CEST

I understand and will adapt my tactic to put a comma behind every word
then I search for double ,, and replace them with 1 ,
and then apply the regular expression.

Still in the second example it stopped rather early.

I must say thank you a lot for the effort.

Is there a site for online testing this regular expression stuff or program.
So I can learn this a bit.
I found a lot in Google but there are different kinds of regular expression for java and other ..

Witch one do I follow best?

And again thank you
Guy Forssman

I have the impression that we are talking about different things.

I gave you regexp examples for a one-line tag-field content.

But you work with multi-line content in the tag-field MOOD?

If there exist multi-line content and other exceptions, then you should have to choose a different strategy.

  • Isolate different cases, treat each case for itself with it's own fitting pattern.
  • If possible, reduce the complexity, reduce the number of cases, ...
    change the appearance of a different case into the appearance of an already existing case, in order to get one pattern for all cases.
  • Divide the whole problem into several single steps (actions), which can be treated by easy reg-expessions or by standard functions.

For example ...
... clean up all different spellings of "," or ", " or " ," or "," or whatever into one format.
... maybe convert multi-line into single-line, do the actions, convert into multi-line.

DD.20140718.1327.CEST

Another proposal.

1. Filter: "$len($regexp(%COMMENT%,'[^\r\n]',))" GREATER 0 2. TEMP <== %COMMENT% 3. TEMP <== $regexp(%TEMP%,'([^,])$','$1,') From: "ETHNO POP - ETHNIC POP MID ,arabazing, lanscape, walk, sharing MEDIUM,arabisant, paysage, partage, marche, ... " To: "ETHNO POP - ETHNIC POP, MID ,arabazing, lanscape, walk, sharing, MEDIUM,arabisant, paysage, partage, marche, ... " 4. TEMP <== $regexp(%TEMP%,'^(.+?)\r?\n(.+?)\r?\n.*$','$1 $2') From: "ETHNO POP - ETHNIC POP, MID ,arabazing, lanscape, walk, sharing, MEDIUM,arabisant, paysage, partage, marche, ... ... " To: "ETHNO POP - ETHNIC POP, MID ,arabazing, lanscape, walk, sharing," 5. TEMP <== $regexp($trim(%TEMP%,','),'\s*,\s*',', ') TEMP = 'ETHNO POP - ETHNIC POP, MID, arabazing, lanscape, walk, sharing' ---------- ... or ... 5a. Tag-Feld aufteilen Split field by separator Field: Temp Separator: , (Note: one letter: comma) 5b. Doppelte Tag-Felder zusammenfassen Merge duplicate fields Field : Temp Separator: , (Note: two letters: comma space) TEMP = 'ETHNO POP - ETHNIC POP, MID, arabazing, lanscape, walk, sharing' ---------- 6. TEMP <== $regexp(%TEMP%,'\b[\u\s/-]+\b,\s',) TEMP = 'arabazing, lanscape, walk, sharing'

DD.20140718.1845.CEST

Hi Thank you very much for the propositions.
I already opened a new thread here /t/15916/1
I also put partial solutions in green

Kind Regards
Guy Forssman