Skip to content
  • Hjem
  • Seneste
  • Etiketter
  • Populære
  • Verden
  • Bruger
  • Grupper
Temaer
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Kollaps
FARVEL BIG TECH
  1. Forside
  2. Ikke-kategoriseret
  3. #WritersCoffeeClub Apr 24 Share a silly mistake you've made while writing.

#WritersCoffeeClub Apr 24 Share a silly mistake you've made while writing.

Planlagt Fastgjort Låst Flyttet Ikke-kategoriseret
writerscoffeecl
93 Indlæg 63 Posters 0 Visninger
  • Ældste til nyeste
  • Nyeste til ældste
  • Most Votes
Svar
  • Svar som emne
Login for at svare
Denne tråd er blevet slettet. Kun brugere med emne behandlings privilegier kan se den.
  • gsuberland@chaos.socialG gsuberland@chaos.social

    @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb or [^\w-] instead of \W for a more careful approach, since the \W class will replace smarty-pants to smarty-trousers. hyphens are not included in \w, so the inverted class \W matches on them, which is unlikely to be what you want. [^\w-] works the same but doesn't treat hyphens as word boundaries to avoid the issue.

    gsuberland@chaos.socialG This user is from outside of this forum
    gsuberland@chaos.socialG This user is from outside of this forum
    gsuberland@chaos.social
    wrote sidst redigeret af
    #77

    @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb annoyingly there's no standard character class that matches word boundaries in Latin script prose with high confidence, e.g. something along the lines of [\s"“”„;:!?¡¿‽.,()\[\]…]

    ilmari@social.treehouse.systemsI 1 Reply Last reply
    0
    • gsuberland@chaos.socialG gsuberland@chaos.social

      @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb or [^\w-] instead of \W for a more careful approach, since the \W class will replace smarty-pants to smarty-trousers. hyphens are not included in \w, so the inverted class \W matches on them, which is unlikely to be what you want. [^\w-] works the same but doesn't treat hyphens as word boundaries to avoid the issue.

      towo@chaos.socialT This user is from outside of this forum
      towo@chaos.socialT This user is from outside of this forum
      towo@chaos.social
      wrote sidst redigeret af
      #78

      @gsuberland
      If you don't care about hyphens, `\bword\b` might be the better choice as a zero-width assertion (i.e. no need for capture groups to retain other characters).

      If you do.. `(?<!-)\bword\b(?!-)` with some perl magic included will do the look backs/lookaheads.

      @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb

      1 Reply Last reply
      0
      • gsuberland@chaos.socialG gsuberland@chaos.social

        @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb annoyingly there's no standard character class that matches word boundaries in Latin script prose with high confidence, e.g. something along the lines of [\s"“”„;:!?¡¿‽.,()\[\]…]

        ilmari@social.treehouse.systemsI This user is from outside of this forum
        ilmari@social.treehouse.systemsI This user is from outside of this forum
        ilmari@social.treehouse.systems
        wrote sidst redigeret af
        #79

        @gsuberland @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb Unicode defines word boundaries, and Perl has \b{wb}, which matches them.

        cstross@wandering.shopC gsuberland@chaos.socialG oblomov@sociale.networkO 3 Replies Last reply
        0
        • ilmari@social.treehouse.systemsI ilmari@social.treehouse.systems

          @gsuberland @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb Unicode defines word boundaries, and Perl has \b{wb}, which matches them.

          cstross@wandering.shopC This user is from outside of this forum
          cstross@wandering.shopC This user is from outside of this forum
          cstross@wandering.shop
          wrote sidst redigeret af
          #80

          @ilmari @gsuberland @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb My perl experience mostly predates unicode 😉

          ilmari@social.treehouse.systemsI 1 Reply Last reply
          0
          • ilmari@social.treehouse.systemsI ilmari@social.treehouse.systems

            @gsuberland @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb Unicode defines word boundaries, and Perl has \b{wb}, which matches them.

            gsuberland@chaos.socialG This user is from outside of this forum
            gsuberland@chaos.socialG This user is from outside of this forum
            gsuberland@chaos.social
            wrote sidst redigeret af
            #81

            @ilmari @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb ooh good to know, thanks

            1 Reply Last reply
            0
            • cstross@wandering.shopC cstross@wandering.shop

              @ilmari @gsuberland @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb My perl experience mostly predates unicode 😉

              ilmari@social.treehouse.systemsI This user is from outside of this forum
              ilmari@social.treehouse.systemsI This user is from outside of this forum
              ilmari@social.treehouse.systems
              wrote sidst redigeret af
              #82

              @cstross @gsuberland @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb To be fair, \b{…} was only added to Perl ten years ago 😉

              cstross@wandering.shopC jernej__s@infosec.exchangeJ 2 Replies Last reply
              0
              • ilmari@social.treehouse.systemsI ilmari@social.treehouse.systems

                @cstross @gsuberland @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb To be fair, \b{…} was only added to Perl ten years ago 😉

                cstross@wandering.shopC This user is from outside of this forum
                cstross@wandering.shopC This user is from outside of this forum
                cstross@wandering.shop
                wrote sidst redigeret af
                #83

                @ilmari @gsuberland @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb Yeah, it's been most of 25 years for me ...

                1 Reply Last reply
                0
                • ilmari@social.treehouse.systemsI ilmari@social.treehouse.systems

                  @cstross @gsuberland @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb To be fair, \b{…} was only added to Perl ten years ago 😉

                  jernej__s@infosec.exchangeJ This user is from outside of this forum
                  jernej__s@infosec.exchangeJ This user is from outside of this forum
                  jernej__s@infosec.exchange
                  wrote sidst redigeret af
                  #84

                  @ilmari @cstross @gsuberland @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb \b has been in regexp far longer, only the Unicode additions are new.

                  ilmari@social.treehouse.systemsI 1 Reply Last reply
                  0
                  • jernej__s@infosec.exchangeJ jernej__s@infosec.exchange

                    @ilmari @cstross @gsuberland @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb \b has been in regexp far longer, only the Unicode additions are new.

                    ilmari@social.treehouse.systemsI This user is from outside of this forum
                    ilmari@social.treehouse.systemsI This user is from outside of this forum
                    ilmari@social.treehouse.systems
                    wrote sidst redigeret af
                    #85

                    @jernej__s @cstross @gsuberland @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb yes, that's why I wrote \b{…}, not \b.

                    1 Reply Last reply
                    0
                    • ilmari@social.treehouse.systemsI ilmari@social.treehouse.systems

                      @gsuberland @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb Unicode defines word boundaries, and Perl has \b{wb}, which matches them.

                      oblomov@sociale.networkO This user is from outside of this forum
                      oblomov@sociale.networkO This user is from outside of this forum
                      oblomov@sociale.network
                      wrote sidst redigeret af
                      #86

                      @ilmari @gsuberland @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb
                      and vim has \< and \> for “directed” word boundary zero-width expression

                      1 Reply Last reply
                      0
                      • gsuberland@chaos.socialG gsuberland@chaos.social

                        @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb or [^\w-] instead of \W for a more careful approach, since the \W class will replace smarty-pants to smarty-trousers. hyphens are not included in \w, so the inverted class \W matches on them, which is unlikely to be what you want. [^\w-] works the same but doesn't treat hyphens as word boundaries to avoid the issue.

                        adamrice@c.imA This user is from outside of this forum
                        adamrice@c.imA This user is from outside of this forum
                        adamrice@c.im
                        wrote sidst redigeret af
                        #87

                        @gsuberland @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb Wait, you’re telling me a word character is not the same as a not-not word character?

                        cstross@wandering.shopC 1 Reply Last reply
                        0
                        • adamrice@c.imA adamrice@c.im

                          @gsuberland @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb Wait, you’re telling me a word character is not the same as a not-not word character?

                          cstross@wandering.shopC This user is from outside of this forum
                          cstross@wandering.shopC This user is from outside of this forum
                          cstross@wandering.shop
                          wrote sidst redigeret af
                          #88

                          @adamrice @gsuberland @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb (Obligatory Bill Clinton joke): It depends what you mean by "word".

                          Less flippantly: is 467130356 a word? Is 17/4/2012 a word? Is !true a word?

                          1 Reply Last reply
                          0
                          • gsuberland@chaos.socialG gsuberland@chaos.social

                            @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb or [^\w-] instead of \W for a more careful approach, since the \W class will replace smarty-pants to smarty-trousers. hyphens are not included in \w, so the inverted class \W matches on them, which is unlikely to be what you want. [^\w-] works the same but doesn't treat hyphens as word boundaries to avoid the issue.

                            flippac@types.plF This user is from outside of this forum
                            flippac@types.plF This user is from outside of this forum
                            flippac@types.pl
                            wrote sidst redigeret af
                            #89

                            @gsuberland @cstross @WellsiteGeo @quixoticgeek @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord @edwinb gonna be blunt: you want to eyeball and confirm every substitution if possible

                            these days you can be told how many potential ones up front for a lot of text pretty fast

                            1 Reply Last reply
                            0
                            • cstross@wandering.shopC cstross@wandering.shop

                              #WritersCoffeeClub Apr 24 Share a silly mistake you've made while writing.

                              Character name changes. If for some reason you change the name of a character you *really* need to double-check that it's changed *everywhere*. Hint: regular expressions and global *conditional* search/replace are your tools. Also how to manage word stemming with regexps. Then triple-check *everything*. Otherwise—guaranteed—you'll flip a character's name in one paragraph and the internet will never let you forget it!

                              realn2s@infosec.exchangeR This user is from outside of this forum
                              realn2s@infosec.exchangeR This user is from outside of this forum
                              realn2s@infosec.exchange
                              wrote sidst redigeret af
                              #90

                              @cstross
                              I would also recommend doing it interactively.
                              Yes you need to confirm every change but you learn where your regex goes wrong
                              Sadly this doesn't help with missed occurrence

                              1 Reply Last reply
                              0
                              • cstross@wandering.shopC cstross@wandering.shop

                                @DJRNDM @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord

                                Groan.

                                s/(\W+?)(pants)(\W+?)/\1trousers\3/ig

                                You could use \b — match a word boundary — instead of \W+? (smallest count of non-word characters preceding the next regexp group) but that'd miss run-on strings ending in pants (eg. InterCappedpants).

                                The pcre search modifiers s///ig are for case-insensitive and global.

                                headword@lingo.lolH This user is from outside of this forum
                                headword@lingo.lolH This user is from outside of this forum
                                headword@lingo.lol
                                wrote sidst redigeret af
                                #91

                                @cstross @DJRNDM @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord

                                This is still not perfect. You would need to make sure every substitution is the correct meaning of ‘pants’. Otherwise you risk sentences like:

                                “Whew! I'm all out of breath after that steep hill,” he trousers.

                                djrndm@chaos.socialD 1 Reply Last reply
                                0
                                • davidtheeviloverlord@mastodon.socialD davidtheeviloverlord@mastodon.social

                                  @cstross

                                  I once changed a character's name from Allan to Ben, and later changed it back.

                                  Reading through the manuscript, I found I had thus invented the Allanch seat.

                                  kf7ccc@mastodon.radioK This user is from outside of this forum
                                  kf7ccc@mastodon.radioK This user is from outside of this forum
                                  kf7ccc@mastodon.radio
                                  wrote sidst redigeret af
                                  #92

                                  @davidtheeviloverlord @cstross I recall a story where one of the characters was pulling up his Brendas. I guess Jean got renamed...

                                  1 Reply Last reply
                                  0
                                  • headword@lingo.lolH headword@lingo.lol

                                    @cstross @DJRNDM @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord

                                    This is still not perfect. You would need to make sure every substitution is the correct meaning of ‘pants’. Otherwise you risk sentences like:

                                    “Whew! I'm all out of breath after that steep hill,” he trousers.

                                    djrndm@chaos.socialD This user is from outside of this forum
                                    djrndm@chaos.socialD This user is from outside of this forum
                                    djrndm@chaos.social
                                    wrote sidst redigeret af
                                    #93

                                    @headword @cstross @owent @alicemcalicepants @nullcolaship @davidtheeviloverlord Hot damn! Totally forgot for a moment there that verb existed.

                                    1 Reply Last reply
                                    0
                                    • folfdk@helvede.netF folfdk@helvede.net shared this topic
                                    Svar
                                    • Svar som emne
                                    Login for at svare
                                    • Ældste til nyeste
                                    • Nyeste til ældste
                                    • Most Votes


                                    • Log ind

                                    • Har du ikke en konto? Tilmeld

                                    • Login or register to search.
                                    Powered by NodeBB Contributors
                                    Graciously hosted by data.coop
                                    • First post
                                      Last post
                                    0
                                    • Hjem
                                    • Seneste
                                    • Etiketter
                                    • Populære
                                    • Verden
                                    • Bruger
                                    • Grupper