- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 05:20 PM
Hello,
I have a string contains "abc\1234"
I would like to extract from the back slash and get the number only such as "1234"
Can someone please help? Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2023 11:43 PM
@Annie10 Please continue to use double back slashes, generally \ has a special meaning example: \n is for the next line and hence scripting languages doesn't allow you to type one single backslash and to cut the meaning of backslash you have to use double slashes.
Conclusion is \\ is equivalent of \ in a string.
Please use the same line of code and it should work fine.
return source.u_name.slice(source.u_name.indexOf('\\')+1);
Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 10:31 AM
Hello,
Can someone please help? I have data coming from an excel file that contains column with user name: 'abc/T1230"
I need help with Transform Map script to extract just the numbers from the user name. I have tried the following, but it did not work. Many thanks to you
return source.u_name.toString().replace(/(\d+)/g, "");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 11:37 PM
Hi,
You can try using the split method. Basically what it does is split your string into an array of substrings. Try this code:
var str = "abc\1234";
var myArray = str.split('\');
The string will be split into two substrings:
myArray [0] = 'abc'
myArray [1] = '1234'
Please mark helpful if correct, thanks!