Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • 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
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. search a keyword (query) in a big text

search a keyword (query) in a big text

Scheduled Pinned Locked Moved C#
databasedebugging
9 Posts 3 Posters 0 Views 1 Watching
  • 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.
  • E Offline
    E Offline
    enginco
    wrote on last edited by
    #1

    hi, firstly sorry for my bad english :) List _AllKWs = new {"simple", "object",...}; string lngText= "For most any Serializeable object, making a Debugger Visualizer is exceeding simple and examples abound. However, if you are trying to build a Debugger engin for an object which is not Serializable or takes too long to Serialize and Deserialize, things are not quite so simple......"; var sss = from kw in _AllKWs where longText.Contains(kw) select kw; foreach (string item in sss) { Console.WriteLine(item); } this code is very simple. The code above is searchs the kws in a big text and lists founded kws. but I want to do much complex. I chenged kWs like this : List _AllKWs = new {"Debugger NOT Debugger engin", "object AND Serializable",...}; 1. scenario it must find only "debugger". If the followed keyword is "engin" it won't be listed kw. 2. scenario I want to find "object" kw. But "Serializable" kw is must exist somewhere in the text. thanx...

    CPalliniC 1 Reply Last reply
    0
    • E enginco

      hi, firstly sorry for my bad english :) List _AllKWs = new {"simple", "object",...}; string lngText= "For most any Serializeable object, making a Debugger Visualizer is exceeding simple and examples abound. However, if you are trying to build a Debugger engin for an object which is not Serializable or takes too long to Serialize and Deserialize, things are not quite so simple......"; var sss = from kw in _AllKWs where longText.Contains(kw) select kw; foreach (string item in sss) { Console.WriteLine(item); } this code is very simple. The code above is searchs the kws in a big text and lists founded kws. but I want to do much complex. I chenged kWs like this : List _AllKWs = new {"Debugger NOT Debugger engin", "object AND Serializable",...}; 1. scenario it must find only "debugger". If the followed keyword is "engin" it won't be listed kw. 2. scenario I want to find "object" kw. But "Serializable" kw is must exist somewhere in the text. thanx...

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      There's a powerful tool fur such things [^]. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      E R 2 Replies Last reply
      0
      • CPalliniC CPallini

        There's a powerful tool fur such things [^]. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        E Offline
        E Offline
        enginco
        wrote on last edited by
        #3

        is it possible with LINQ or EXPRESIONs? are there any easy way? I can write some methods, yes, but I can't visualize that efficiency. by the way I don't now how to use REGEX :(

        CPalliniC 1 Reply Last reply
        0
        • E enginco

          is it possible with LINQ or EXPRESIONs? are there any easy way? I can write some methods, yes, but I can't visualize that efficiency. by the way I don't now how to use REGEX :(

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          enginço wrote:

          by the way I don't now how to use REGEX

          Good time to learn. They're sooooooo powerful! :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          In testa che avete, signor di Ceprano?

          1 Reply Last reply
          0
          • CPalliniC CPallini

            There's a powerful tool fur such things [^]. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #5

            And here too. :| See here[^] :suss:

            Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Microsoft MVP - Visual C++[^]

            CPalliniC 1 Reply Last reply
            0
            • R Rajesh R Subramanian

              And here too. :| See here[^] :suss:

              Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Microsoft MVP - Visual C++[^]

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6

              Thanks.

              Rajesh R Subramanian wrote:

              See here

              Balanced. :-D

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              In testa che avete, signor di Ceprano?

              R 1 Reply Last reply
              0
              • CPalliniC CPallini

                Thanks.

                Rajesh R Subramanian wrote:

                See here

                Balanced. :-D

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                R Offline
                R Offline
                Rajesh R Subramanian
                wrote on last edited by
                #7

                Occasionally I go to the "messages posted" page of yours (and a few others too), just to find and fix those unfair votes. A dirty job, but someone has to do it. :| Thanks for the vote BTW. :)

                Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Microsoft MVP - Visual C++[^]

                CPalliniC 1 Reply Last reply
                0
                • R Rajesh R Subramanian

                  Occasionally I go to the "messages posted" page of yours (and a few others too), just to find and fix those unfair votes. A dirty job, but someone has to do it. :| Thanks for the vote BTW. :)

                  Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Microsoft MVP - Visual C++[^]

                  CPalliniC Offline
                  CPalliniC Offline
                  CPallini
                  wrote on last edited by
                  #8

                  Rajesh R Subramanian wrote:

                  Occasionally I go to the "messages posted" page of yours (and a few others too), just to find and fix those unfair votes. A dirty job, but someone has to do it

                  I know I should do on yours, but, you know, I'm not lazy: I've a wife and a little child. :-D (just kidding: I will do the dirty job!) :)

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  In testa che avete, signor di Ceprano?

                  R 1 Reply Last reply
                  0
                  • CPalliniC CPallini

                    Rajesh R Subramanian wrote:

                    Occasionally I go to the "messages posted" page of yours (and a few others too), just to find and fix those unfair votes. A dirty job, but someone has to do it

                    I know I should do on yours, but, you know, I'm not lazy: I've a wife and a little child. :-D (just kidding: I will do the dirty job!) :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    R Offline
                    R Offline
                    Rajesh R Subramanian
                    wrote on last edited by
                    #9

                    CPallini wrote:

                    I know I should do on yours, but, you know, I'm not lazy: I've a wife and a little child.

                    This time the wife and the kid gets a nice treatment. You are NOT lazy because of them. :-D

                    Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Microsoft MVP - Visual C++[^]

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups