If you're going to use a REGEX in `split`, you nee...
# suitescript
e
If you're going to use a REGEX in
split
, you need the
'r'
second parameter
m
hey Eric, thanks for the response! I've used the
'r'
flag with each of those newline options but still haven't cracked it unfortunately. Please let me know if you have any other suggestions!
e
What exactly is being entered into this text area that you're trying to split apart?
If you just need to split on end of line, I would expect a Regex of
$
to work
m
meaning
?split(/$/, 'r')
? it's a Text Area record property that i'm trying to split
e
I think
?split("$", "r")
I don't think Freemarker uses the
/regex/flags
structure
Example
s?replace('ba*', 'XY', 'r')
notice they use
'ba*'
not
/ba*/
m
👍 testing now
didn't seem to be the ticket
my code is
Copy code
<#list record.custbody_banking_details?split("$",'r') as x>
  with "$": ${x}
</#list>
<hr></hr>
so i'd expect to see the phrase "with $" at the start of each sequence item
but what i'm seeing is
Copy code
with "$": First Line
Second Line...
so it looks to me like it's not splitting correctly, and is passing the entire text area string as a single item
when i use the console,
nlapiGetFieldValue('custbody_banking_details')
I can split with
\n
and it works just fine
e
Might I recommend copying the value from the Text Area into a text editor that will display non-printing characters
Who knows what freemarker is translating
\n
to
m
Got it! It's just <br />, which I guess wasn't caught by <br */?>
e
interesting
well done!