DeleteCases using two lists but with partial match?Pattern to match L, but not L[_]Using DeleteCases with multiple AstronomicalData propertiesUsing the string Match with options!Filtering lists by partial matchesProblem with DeleteCasesDeleteCases and Pattern Matching With NumberQUsing DeleteCases to match a string patternSelecting elements using two listsusing DeleteCases to delete vectors with particular index as 0Using DeleteCases with a defined function with two arguments as a pattern

size of pointers and architecture

Palindromic Pan digital Special Square wants you to reveal its Root

If a character has cast the Fly spell on themselves, can they "hand off" to the Levitate spell without interruption?

How do you earn the reader's trust?

Way of refund if scammed?

Why "strap-on" boosters, and how do other people say it?

Efficient Algorithms for Destroyed Document Reconstruction

Find this Unique UVC Palindrome ( ignoring signs and decimal) from Given Fractional Relationship

What is the required burn to keep a satellite at a Lagrangian point?

Illustrating that universal optimality is stronger than sphere packing

DeleteCases using two lists but with partial match?

Can diplomats be allowed on the flight deck of a commercial European airline?

Unary Enumeration

Shell builtin `printf` line limit?

Real Analysis: Proof of the equivalent definitions of the derivative.

Nunc est bibendum: gerund or gerundive?

How to become an Editorial board member?

Split into three!

How do I write real-world stories separate from my country of origin?

Ribbon Cable Cross Talk - Is there a fix after the fact?

What is the winged creature on the back of the Mordenkainen's Tome of Foes book?

Adobe Illustrator: How can I change the profile of a dashed stroke?

Why is unzipped file smaller than zipped file

How would a physicist explain this starship engine?



DeleteCases using two lists but with partial match?


Pattern to match L, but not L[_]Using DeleteCases with multiple AstronomicalData propertiesUsing the string Match with options!Filtering lists by partial matchesProblem with DeleteCasesDeleteCases and Pattern Matching With NumberQUsing DeleteCases to match a string patternSelecting elements using two listsusing DeleteCases to delete vectors with particular index as 0Using DeleteCases with a defined function with two arguments as a pattern













3












$begingroup$


I searched and tried different solutions on SE but nothing worked.



I have two lists and would like to remove items from list1 that have a PARTIAL match with items in list2. I'm new to this.



I tried this but it didn't filter anything out



Select[List1, ! MemberQ[List2, #] &]


I also tried with DeleteCases and StringMatchQ but only got various errors. I tried a few solutions from SE but none worked for my specific case.



list1 = "http://www.domain.com/research", "http://www.domain.com/signup", "tel:5559986644", "mailto:info@domain.com"



list2 = "tel:", "mailto:"



results = "http://www.domain.com/research", "http://www.domain.com/signup"



Thank you in advance










share|improve this question









$endgroup$
















    3












    $begingroup$


    I searched and tried different solutions on SE but nothing worked.



    I have two lists and would like to remove items from list1 that have a PARTIAL match with items in list2. I'm new to this.



    I tried this but it didn't filter anything out



    Select[List1, ! MemberQ[List2, #] &]


    I also tried with DeleteCases and StringMatchQ but only got various errors. I tried a few solutions from SE but none worked for my specific case.



    list1 = "http://www.domain.com/research", "http://www.domain.com/signup", "tel:5559986644", "mailto:info@domain.com"



    list2 = "tel:", "mailto:"



    results = "http://www.domain.com/research", "http://www.domain.com/signup"



    Thank you in advance










    share|improve this question









    $endgroup$














      3












      3








      3





      $begingroup$


      I searched and tried different solutions on SE but nothing worked.



      I have two lists and would like to remove items from list1 that have a PARTIAL match with items in list2. I'm new to this.



      I tried this but it didn't filter anything out



      Select[List1, ! MemberQ[List2, #] &]


      I also tried with DeleteCases and StringMatchQ but only got various errors. I tried a few solutions from SE but none worked for my specific case.



      list1 = "http://www.domain.com/research", "http://www.domain.com/signup", "tel:5559986644", "mailto:info@domain.com"



      list2 = "tel:", "mailto:"



      results = "http://www.domain.com/research", "http://www.domain.com/signup"



      Thank you in advance










      share|improve this question









      $endgroup$




      I searched and tried different solutions on SE but nothing worked.



      I have two lists and would like to remove items from list1 that have a PARTIAL match with items in list2. I'm new to this.



      I tried this but it didn't filter anything out



      Select[List1, ! MemberQ[List2, #] &]


      I also tried with DeleteCases and StringMatchQ but only got various errors. I tried a few solutions from SE but none worked for my specific case.



      list1 = "http://www.domain.com/research", "http://www.domain.com/signup", "tel:5559986644", "mailto:info@domain.com"



      list2 = "tel:", "mailto:"



      results = "http://www.domain.com/research", "http://www.domain.com/signup"



      Thank you in advance







      pattern-matching filtering






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 3 hours ago









      Sam BSam B

      485




      485




















          1 Answer
          1






          active

          oldest

          votes


















          3












          $begingroup$

          Cases[_?(Not@*StringStartsQ[Alternatives @@ list2])]@list1
          Cases[Except[_?(StringStartsQ[Alternatives@@list2])]]@list1
          DeleteCases[_?(StringStartsQ[Alternatives @@ list2])]@list1
          Select[list1, Not @* StringStartsQ[Alternatives @@ list2]]


          all give




          "http://www.domain.com/research", "http://www.domain.com/signup"




          You can also use the pattern _?(StringMatchQ[#, Alternatives @@ list2 ~~ "*"]&), e.g.,



          DeleteCases[list1, _?(StringMatchQ[#,Alternatives @@ list2~~"*"]&)]



          same result







          share|improve this answer











          $endgroup$













            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "387"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f198685%2fdeletecases-using-two-lists-but-with-partial-match%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3












            $begingroup$

            Cases[_?(Not@*StringStartsQ[Alternatives @@ list2])]@list1
            Cases[Except[_?(StringStartsQ[Alternatives@@list2])]]@list1
            DeleteCases[_?(StringStartsQ[Alternatives @@ list2])]@list1
            Select[list1, Not @* StringStartsQ[Alternatives @@ list2]]


            all give




            "http://www.domain.com/research", "http://www.domain.com/signup"




            You can also use the pattern _?(StringMatchQ[#, Alternatives @@ list2 ~~ "*"]&), e.g.,



            DeleteCases[list1, _?(StringMatchQ[#,Alternatives @@ list2~~"*"]&)]



            same result







            share|improve this answer











            $endgroup$

















              3












              $begingroup$

              Cases[_?(Not@*StringStartsQ[Alternatives @@ list2])]@list1
              Cases[Except[_?(StringStartsQ[Alternatives@@list2])]]@list1
              DeleteCases[_?(StringStartsQ[Alternatives @@ list2])]@list1
              Select[list1, Not @* StringStartsQ[Alternatives @@ list2]]


              all give




              "http://www.domain.com/research", "http://www.domain.com/signup"




              You can also use the pattern _?(StringMatchQ[#, Alternatives @@ list2 ~~ "*"]&), e.g.,



              DeleteCases[list1, _?(StringMatchQ[#,Alternatives @@ list2~~"*"]&)]



              same result







              share|improve this answer











              $endgroup$















                3












                3








                3





                $begingroup$

                Cases[_?(Not@*StringStartsQ[Alternatives @@ list2])]@list1
                Cases[Except[_?(StringStartsQ[Alternatives@@list2])]]@list1
                DeleteCases[_?(StringStartsQ[Alternatives @@ list2])]@list1
                Select[list1, Not @* StringStartsQ[Alternatives @@ list2]]


                all give




                "http://www.domain.com/research", "http://www.domain.com/signup"




                You can also use the pattern _?(StringMatchQ[#, Alternatives @@ list2 ~~ "*"]&), e.g.,



                DeleteCases[list1, _?(StringMatchQ[#,Alternatives @@ list2~~"*"]&)]



                same result







                share|improve this answer











                $endgroup$



                Cases[_?(Not@*StringStartsQ[Alternatives @@ list2])]@list1
                Cases[Except[_?(StringStartsQ[Alternatives@@list2])]]@list1
                DeleteCases[_?(StringStartsQ[Alternatives @@ list2])]@list1
                Select[list1, Not @* StringStartsQ[Alternatives @@ list2]]


                all give




                "http://www.domain.com/research", "http://www.domain.com/signup"




                You can also use the pattern _?(StringMatchQ[#, Alternatives @@ list2 ~~ "*"]&), e.g.,



                DeleteCases[list1, _?(StringMatchQ[#,Alternatives @@ list2~~"*"]&)]



                same result








                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 26 mins ago

























                answered 3 hours ago









                kglrkglr

                193k10214434




                193k10214434



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Mathematica Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f198685%2fdeletecases-using-two-lists-but-with-partial-match%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Log på Navigationsmenu

                    Creating second map without labels using QGIS?How to lock map labels for inset map in Print Composer?How to Force the Showing of Labels of a Vector File in QGISQGIS Valmiera, Labels only show for part of polygonsRemoving duplicate point labels in QGISLabeling every feature using QGIS?Show labels for point features outside map canvasAbbreviate Road Labels in QGIS only when requiredExporting map from composer in QGIS - text labels have moved in output?How to make sure labels in qgis turn up in layout map?Writing label expression with ArcMap and If then Statement?

                    Nuuk Indholdsfortegnelse Etyomologi | Historie | Geografi | Transport og infrastruktur | Politik og administration | Uddannelsesinstitutioner | Kultur | Venskabsbyer | Noter | Eksterne henvisninger | Se også | Navigationsmenuwww.sermersooq.gl64°10′N 51°45′V / 64.167°N 51.750°V / 64.167; -51.75064°10′N 51°45′V / 64.167°N 51.750°V / 64.167; -51.750DMI - KlimanormalerSalmonsen, s. 850Grønlands Naturinstitut undersøger rensdyr i Akia og Maniitsoq foråret 2008Grønlands NaturinstitutNy vej til Qinngorput indviet i dagAntallet af biler i Nuuk må begrænsesNy taxacentral mødt med demonstrationKøreplan. Rute 1, 2 og 3SnescootersporNuukNord er for storSkoler i Kommuneqarfik SermersooqAtuarfik Samuel KleinschmidtKangillinguit AtuarfiatNuussuup AtuarfiaNuuk Internationale FriskoleIlinniarfissuaq, Grønlands SeminariumLedelseÅrsberetning for 2008Kunst og arkitekturÅrsberetning for 2008Julie om naturenNuuk KunstmuseumSilamiutGrønlands Nationalmuseum og ArkivStatistisk ÅrbogGrønlands LandsbibliotekStore koncerter på stribeVandhund nummer 1.000.000Kommuneqarfik Sermersooq – MalikForsidenVenskabsbyerLyngby-Taarbæk i GrønlandArctic Business NetworkWinter Cities 2008 i NuukDagligt opdaterede satellitbilleder fra NuukområdetKommuneqarfik Sermersooqs hjemmesideTurist i NuukGrønlands Statistiks databankGrønlands Hjemmestyres valgresultaterrrWorldCat124325457671310-5