Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8325317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:23:32+00:00 2026-06-09T00:23:32+00:00

>str= AAC|Australia Acquisition Corp. – Ordinary Shares|S|N|D|100 > strsplit(str,\\|) [[1]] [1] AAC [2] Australia

  • 0
>str= "AAC|Australia Acquisition Corp. - Ordinary Shares|S|N|D|100"
> strsplit(str,"\\|")
[[1]]
[1] "AAC"                                          
[2] "Australia Acquisition Corp. - Ordinary Shares"
[3] "S"                                            
[4] "N"                                            
[5] "D"                                            
[6] "100"   

I wonder \\| is equal to | ?
maybe \\|is equal to \| ,
why can strsplit(str,"\\|") work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:23:34+00:00Added an answer on June 9, 2026 at 12:23 am

    Because it’s a quoted string.
    In a quoted string, you can include a " character by escaping it with a \. A \ itself then also needs to be escaped to be a single literal backslash. So your quoted string means: \|.

    Now in a regular expression a | is a special character that is not matched literally unless it is escaped. Regular Expressions in R also escape with a backslash, so the string literal "\\|" means the string \| which is an expression matching exactly |. Why "\\|" works is because that means matching exactly | which appears as the separator in the string you’re splitting.

    A more specific reference to regular expressions in R might be handy, but it, as many do, references perl regular expressions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

str = Hello☺ World☹ Expected output is: Hello:) World:( I can do this: str.gsub(☺,
str = cruel world #pattern can be /(?<a>.)(?<b>.)/ OR /(?<b>.)(?<a>.)/ #which was inputted by
char str[] = http://www.ibegroup.com/; char *p = str ; void Foo ( char str[100]){
The str_replace function with a strpos checking can avoid extra work? METHOD 1 ...
NSString *str = [[[[NSString alloc]init]autorelease]autorelease]; str = @hii; NSLog(@%@,str); Can any one help me
str = "&&"; label1.Text = str; but it only shows "&". How do I
String str = abcde123_92qwq_1a_02x_1e; I want to replace the first string part between the
string str = one three; string::iterator it; string add = two ; Lets say
if(str.contains(final)) { id = Integer.parseInt(str.substring(18, str.length() - 6)); } System.out.println(id); This line of code
function escCtrlChars(str) { return str.replace(/[\0\t\n\v\f\r\xa0'!-]/g, function(c) { return '!' + c.charCodeAt(0) + '!'; });

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.