Community
    • Login

    Not able to post...

    Scheduled Pinned Locked Moved General Discussion
    6 Posts 2 Posters 3.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DaveyDD
      DaveyD
      last edited by

      Hi. I tried posting a question in the “Help” section, but I got a message that Akismet considered the post content as spam!???

      Anyone know the reason for this and how to overcome it?

      Thanks,
      David

      1 Reply Last reply Reply Quote 0
      • dailD
        dail
        last edited by

        At one point spam was really bad so some forum plugins were put in place to help counter it. I have no idea how it works or what it looks for. Not sure if it detects suspicious links or weird characters/formatting. Maybe rewording or changing some links might help.

        1 Reply Last reply Reply Quote 0
        • DaveyDD
          DaveyD
          last edited by

          @dail, thanks - I’ll try it
          In the meantime, can anyone remove the 3 attempted posts?
          They are each named “Interesting behavior with string in python script”
          They are broken - clicking on it just leads to an error

          Thanks,
          David

          1 Reply Last reply Reply Quote 0
          • DaveyDD
            DaveyD
            last edited by

            @dail, I just tried posting it again and I got the same problem.
            I don’t know what to do to fix it - I will post a screenshot of my question here

            Please let me know what you think
            Thanks,
            David

            1 Reply Last reply Reply Quote 0
            • dailD
              dail
              last edited by dail

              can anyone remove the 3 attempted posts?

              None of them show up for me.

              To answer your actual question though…It is recommended to use raw strings in Python when writing regular expressions (some other languages have this type of feature as well).

              Since “\s” and “\d” are not known escape sequences to Python then it treats “\s” as 2 separate characters (same with “\d”). However as you noticed “\b” is a known escape sequence so Python treats this as a single character: a backspace.

              So your original python code could be written as:

              mySearch = r"(command|function)\s+\d+\s+" + myWord + r"\b"
              

              Notice the 2 "r"s before the strings. Technically it is not needed for the first string (it works fine with it there though) but I’ve found it to be good practice to always use raw strings when using regular expressions.

              Luckily Notepad++ takes care of this for you when you use the Find/Replace so you normally don’t have to worry about this :)

              1 Reply Last reply Reply Quote 1
              • DaveyDD
                DaveyD
                last edited by

                @Dail - thanks! I didn’t know that \b was a special character in python!
                Lesson learned - use raw strings… :)

                Thanks,
                David

                P.S. Regarding those posts - that’s really weird! I see 3 posts in the “Need Help” section - all have 0 views…

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors