Options

"Regular expression problem..."

AxelAxel Member Posts: 19 Maven
edited May 2019 in Help
Hi everbody,

I try to use the Mapping operator to replace some attribute values by others.
Possible values are:  "disease1", "disiease2", "disease3" and  "Healthy".
I want to replace everything that is NOT "Healthy" by  "Sick" and try a regex with negative lookahead like this: ^(?!Healthy).

Unfortunately, nothing is replaced :-(
What am I doing wrong ?  When I test the regex at http://www.regexplanet.com/simple/index.html it seems to work.

Thanks,

Axel
Tagged:

Answers

  • Options
    haddockhaddock Member Posts: 849 Maven
    Hi there Axel,

    I think you needed a bit more, like this...
    <operator name="Root" class="Process" expanded="yes">
        <operator name="ExampleSetGenerator" class="ExampleSetGenerator">
            <parameter key="target_function" value="random"/>
        </operator>
        <operator name="BinDiscretization" class="BinDiscretization">
            <parameter key="range_name_type" value="short"/>
        </operator>
        <operator name="Replace" class="Replace">
            <parameter key="attributes" value="a.*"/>
            <parameter key="replace_what" value="\b(?:(?!range1)\w)+\b"/>
            <parameter key="replace_by" value="Haddock"/>
        </operator>
    </operator>
    Regex can turn normal humans to wobbly puddings, so I use RegexBuddy, and commend it to all but the most pointy-headed ascetics.


    Pip Pip

    ( Exit Uncle Beastly stage left...)



  • Options
    steffensteffen Member Posts: 347 Maven
    This is madness  :o

    If the possible values are restricted to those mentioned by axel, then use this one:

    disease.*
    regards,

    steffen
  • Options
    haddockhaddock Member Posts: 849 Maven
    Steffen, really!!  :'(
    If the possible values are restricted to those mentioned by axel, then use this one:
    True enough. But that is not what
    "everything that is NOT "Healthy""
    means.

  • Options
    steffensteffen Member Posts: 347 Maven
    "If I had been silent, I would have remained a philosopher" - my latin is worse than my ability to read texts in detail.

    I apologize ...
  • Options
    haddockhaddock Member Posts: 849 Maven
    Just joshin', friend, was it not old Seneca, he of the slit wrists who said...
    Aliquando et insanire iucundum est...
    ?
  • Options
    awchisholmawchisholm RapidMiner Certified Expert, Member Posts: 458 Unicorn
    Speaking as a newbie I can confirm utter madness when looking at some of the more esoteric Rapidminer operators.

    but I believe Seneca said

    "Nullum magnum ingenium sine mixtura dementiae fuit"
  • Options
    AxelAxel Member Posts: 19 Maven
    Hi haddock,

    that was exactly what I was looking for. I can only say:
    Plures gratiae pro vestri succurro

    Axel
Sign In or Register to comment.