Cant Replace \n in string variables with text manipulation

Xaon420

New member
If there is a way I cant seek to get it at all, is there a way to look for \n?

If you try normally or bracketing it still reads the backslash, in my case I'm trying to replace the backslash to a character that's readable

Any way to clear " \n " at all?
Backslash needs to be removed as well
 

Dm114

Well-known member
If there is a way I cant seek to get it at all, is there a way to look for \n?

If you try normally or bracketing it still reads the backslash, in my case I'm trying to replace the backslash to a character that's readable

Any way to clear " \n " at all?
Backslash needs to be removed as well
As a workaround you could do this way (in 3 steps it works for me):
1st step: Replace all '\' by '*' or any other special character i.e. '\\' --> '*'
2nd step: Replace all '*n' by empty string i.e. '\*n' --> empty string (to remove them or any other character or string)
3rd step: Replace all '*' by '\' i.e. '\*' --> '\'
 

Xaon420

New member
Can't even make first step...
My problem is that replace all doesn't read \
It won't work even with brackets wrapping it

I'm starting to see this as a feature was added I'm guessing the dev didn't add a way to cancel this problem(like I said before bracket wrap would be perfect here)
 

Attachments

  • Screenshot_20210806-141034_MacroDroid.jpg
    Screenshot_20210806-141034_MacroDroid.jpg
    328.1 KB · Views: 13

Xaon420

New member
So I used '\n' instead of just \n and even just '\'

I still belive this is a bug or missed problem because even with it reporting no error now its not doing any replacement At all

(Uploaded 2 incase one was pixels again)
 

Attachments

  • Screenshot_20210806-142357_MacroDroid.jpg
    Screenshot_20210806-142357_MacroDroid.jpg
    314 KB · Views: 11
  • Screenshot_20210806-142138_MacroDroid.jpg
    Screenshot_20210806-142138_MacroDroid.jpg
    315 KB · Views: 10

Xaon420

New member
As a workaround you could do this way (in 3 steps it works for me):
1st step: Replace all '\' by '*' or any other special character i.e. '\\' --> '*'
2nd step: Replace all '*n' by empty string i.e. '\*n' --> empty string (to remove them or any other character or string)
3rd step: Replace all '*' by '\' i.e. '\*' --> '\'
Sorry I forgot to reply as well but I did post twice on a update
 

420

Active member
So I used '\n' instead of just \n and even just '\'

I still belive this is a bug or missed problem because even with it reporting no error now its not doing any replacement At all

(Uploaded 2 incase one was pixels again)
if your variable doesn't contain any non a-z character (other then the backslash) you could use this "[^a-z]n"

if that doesn't work for you then maybe you can find something that does using this tool: https://regex101.com/
 

Xaon420

New member
if your variable doesn't contain any non a-z character (other then the backslash) you could use this "[^a-z]n"

if that doesn't work for you then maybe you can find something that does using this tool: https://regex101.com/

Yah I'll check that out if not ill make another post on suggestions board to fix this or at least adding a bypass for it as "[^a-z]n" makes the same error as before if any backslash is included

Also regex.com works fine its on macrodroid i think as its only when I use a backslash and alot of https sites have \n for newline, I remember being able to remove them before Jan 2021, I even had a macro that removed \n from any string (never made it public) and for some reason I can't now I get errors when trying to bracket wrap the backslash, even using "[^\]n" and "[^\-\]n" and obviously I doesn't work but also throws a error from the backslash.

So ill have to make another post on bugs/requests and hope it's seen
 
Last edited:

Dm114

Well-known member
Can't even make first step...
My problem is that replace all doesn't read \
It won't work even with brackets wrapping it

I'm starting to see this as a feature was added I'm guessing the dev didn't add a way to cancel this problem(like I said before bracket wrap would be perfect here)
The exact syntax to use is the one after each 'i.e.' without any quote nor other character
 

Xaon420

New member
The exact syntax to use is the one after each 'i.e.' without any quote nor other character
Yes im aware however this worked a while ago and doesn't work now even without any other quotes, ect.

Doing replace \ or \n doesn't work At all and I need to remove them, yet I can't do this because text manipulation reads backslash as something else not just a character like % or $, I use text manipulation alot, everything works except for replacing \n with anything, it throws an error or just doesn't replace \n, the \n's come from http get and im filtering the result all I have left are \n's and cant change them.

replacing \ at all makes an error, Adding '\n' works but doesn't replace \n in my string

Again I had macros that did this before after a wipe, new phone and restore I cant find one that works
 

Dm114

Well-known member
Yes im aware however this worked a while ago and doesn't work now even without any other quotes, ect.

Doing replace \ or \n doesn't work At all and I need to remove them, yet I can't do this because text manipulation reads backslash as something else not just a character like % or $, I use text manipulation alot, everything works except for replacing \n with anything, it throws an error or just doesn't replace \n, the \n's come from http get and im filtering the result all I have left are \n's and cant change them.

replacing \ at all makes an error, Adding '\n' works but doesn't replace \n in my string

Again I had macros that did this before after a wipe, new phone and restore I cant find one that works
To me it works fine in 3 steps. So, may be you missed something...

You are right: when you escape \n with a backslash it doesn't work. But if you escape \ alone with a backslash, it works fine. It's the reason why I did it in 3 steps for you not to get stuck.

Let's wait for @MacroDroidDev to come back from holidays. May be he'll have an explanation...
 

Xaon420

New member
Honestly I will be straight I used a 3 part system a while back (memory is shotty srry), but i did manage the \ only but now I'm stuck with n's

So im trying something today here soon but I will mention on the post if I find anything, anyway not sure but I hope the dev can help a bit but I'm gonna try and replace \ with a different symbol, if i can I may be able to use something like &

I'll Feedback if these work
1: replacing it with & or $
~ although I have a problem with this as the character I'm looking for is beside n, this causes it not to read.
2: Replace $n with nothing
~ should work obviously.

But yea im waiting for the dev as well I had forgotten he was away for a bit.
 

Xaon420

New member
Problem that I forgot as well

Using \ errors.
Using [\] also errors.
Using ['\'] or ["\"] works but doesn't replace \ from my variable still.

Sadly I have to wait for the dev I believe
 

Attachments

  • Screenshot_20210813-221714_MacroDroid.jpg
    Screenshot_20210813-221714_MacroDroid.jpg
    330 KB · Views: 9

Dm114

Well-known member
Problem that I forgot as well

Using \ errors.
Using [\] also errors.
Using ['\'] or ["\"] works but doesn't replace \ from my variable still.

Sadly I have to wait for the dev I believe
As I told you in my first reply, to replace \ (backslash) you must escape it with another backslah. So you'll have \\ to be replace by whatever character you want.

Please refer to my 1st post and it'll work nicely (don't put any single quote in strings, they were just to isolate strings to be used apart from text).
 

Xaon420

New member
Well odd to day that hadn't worked originally, I even said any backslashs at all cause a error, the one I posted before, after a restart(phone died) apparently its working fine and doesn't throw any error anymore and the pop-up is showing me it's working now.

And i take my time to read posts,
I've been scouring the forum for any other problems like mine were i was getting errors with things that should work (also yes I had tried \\ yesterday )

Also I mistyped my last response I had said \\ for the 2 first errors I had (btw the pop-ups didn't show me anything working either). I just wanna clear that as i thought I mentioned that.

I belive samungs updates are not helping, I get problems after updates, so I havnt updated my phone in a month

anyway I'll report back if I get problems with it again.
 
Top