LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Replace Node

    Employee
    Posted 06-29-2016 05:32

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Jagdev

    Hi Experts,

    I am facing an issue while replacing Text from a word or group of words.

    Ex -

    Stone Age
    one Sam

    I want to replace "one" with "1" from these words/column

    When I am applying any methodology it is removing the "one" from everywhere in the column.

    Current Output
    St1 Age
    1 Sam

    Expected Output -

    Stone Age
    1 Sam

    Please let me know how to fix this up.

    Regards,
    Jagdev


  • 2.  RE: Replace Node

    Employee
    Posted 06-29-2016 06:27

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: awilliams1024

    Hi Jagdev,

    I think the Regular Expression functionality would be appropriate here as it allows you to 'anchor' the match to the start of the string. Copy and paste this example into the BRE canvas. See the Regular Expression Operators section of the BRAINScript help for details of this and other operators that support regular expressions.

    node:Static_Data
    bretype:core::Static Data
    editor:sortkey=5773c60741fc50a5
    output:@40fe6c55598828e5/=
    prop:StaticData=<<EOX
    data:string,payload:string
    "Stone Age","text"
    "one Sam","text"
    
    EOX
    editor:XY=240,160
    end:Static_Data
    
    node:Filter
    bretype:core::Filter
    editor:sortkey=5773c62f57ad05ce
    input:@40fd2c74167f1ca2/=Static_Data.40fe6c55598828e5
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    tmpStr = regexSubstitute(data, "^one", "1")
    
    emit *
    exclude data
    emit tmpStr as "data"
    
    EOX
    editor:XY=350,160
    end:Filter

    Regards,
    Adrian