Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python escaping character
#1
Hi guys,

How can i escape the special character from this sql . it is store as string

SELECT REGEXP_SUBSTR(SYS_CONNECT_BY_PATH(nom, '\'), '[^\]+', 3, 4)
Reply
#2
SELECT REGEXP_SUBSTR(SYS_CONNECT_BY_PATH(nom, '\\'), r'[^\]+', 3, 4)
The first literal \ must be escaped with another \.

Using a raw string (sometimes called regex string) does not help, because after the backslash comes the quotation mark.

The second string literal can be written as raw string, because the quotation mark does not follow after the backslash.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python rule about the space character surrounding the equal sign ineuw 10 1,942 Sep-21-2023, 09:17 AM
Last Post: ineuw
  How do I handle escape character in parameter arguments in Python? JKR 6 1,527 Sep-12-2023, 03:00 AM
Last Post: Apoed2023
  [solved] unexpected character after line continuation character paul18fr 4 3,709 Jun-22-2021, 03:22 PM
Last Post: deanhystad
  python error: bad character range \|-t at position 12 faustineaiden 0 3,809 May-28-2021, 09:38 AM
Last Post: faustineaiden
  Reducing JSON character count in Python for a Twitter Bot johnmitchell85 2 70,296 Apr-28-2021, 06:08 PM
Last Post: johnmitchell85
  Introduction to escaping characters in strings Geelong_crazy 1 2,958 Jul-18-2020, 06:58 PM
Last Post: DT2000
  SyntaxError: unexpected character after line continuation character siteshkumar 2 3,344 Jul-13-2020, 07:05 PM
Last Post: snippsat
  Help ANSI character and python... sid4g 2 2,535 Mar-19-2020, 06:08 PM
Last Post: sid4g
  Escaping '$' in pymongo raulp2301 0 1,744 Feb-14-2020, 03:48 PM
Last Post: raulp2301
  how can i handle "expected a character " type error , when I input no character vivekagrey 2 2,870 Jan-05-2020, 11:50 AM
Last Post: vivekagrey

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020