Loading ...
Sorry, an error occurred while loading the content.

RegExp Question

Expand Messages
  • Gadrin
    Is this even possible ? given the following buffer: With qdfBestSellers .Connect = ODBC;DATABASE=pubs;UID=sa;PWD=; & _ DSN=Publishers .SQL = SELECT title,
    Message 1 of 6 , Sep 15, 2005
    • 0 Attachment
      Is this even possible ?

      given the following buffer:

      With qdfBestSellers
      .Connect = "ODBC;DATABASE=pubs;UID=sa;PWD=;" & _
      "DSN=Publishers"
      .SQL = "SELECT title, title_id FROM titles " & _
      "ORDER BY ytd_sales DESC"
      Set rstTopSeller = .OpenRecordset()
      rstTopSeller.MoveFirst
      End With

      I'd like to match the "words"

      .Connect
      .SQL
      .OpenRecordset()

      but can't seem to using "\b\\." which I assume is due to the fact
      that the period character isn't considered a word character, so "\<"
      won't help either.

      It's quite possible that there won't be a space in front of the
      period in further tests, so I'd rather not use "\ \\." either.

      anybody have an ideas ?
    • Thomas Hundt
      Suggestions: 1. Turn on magic mode in the buffer (right click on the modeline for menu!). This enables regexp recognition in searches. (I leave this
      Message 2 of 6 , Sep 15, 2005
      • 0 Attachment
        Suggestions:

        1. Turn on "magic" mode in the buffer (right click on the modeline for
        menu!). This enables regexp recognition in searches. (I leave this
        enabled permanently.)

        2. Use isearch-forward, and build/test your regular expression that way,
        with immediate feedback.

        I take it you wish to match the beginning of line?
        I used "^\W*\.\w+" just now to match the ".words". (That doesn't match
        .OpenRecordset, though.)

        Good luck

        -Th



        Gadrin wrote:
        > Is this even possible ?
        >
        > given the following buffer:
        >
        > With qdfBestSellers
        > .Connect = "ODBC;DATABASE=pubs;UID=sa;PWD=;" & _
        > "DSN=Publishers"
        > .SQL = "SELECT title, title_id FROM titles " & _
        > "ORDER BY ytd_sales DESC"
        > Set rstTopSeller = .OpenRecordset()
        > rstTopSeller.MoveFirst
        > End With
        >
        > I'd like to match the "words"
        >
        > .Connect
        > .SQL
        > .OpenRecordset()
        >
        > but can't seem to using "\b\\." which I assume is due to the fact
        > that the period character isn't considered a word character, so "\<"
        > won't help either.
        >
        > It's quite possible that there won't be a space in front of the
        > period in further tests, so I'd rather not use "\ \\." either.
        >
        > anybody have an ideas ?
        >
        >
      • Gadrin
        magic is set... search-forward .[A-Za-z] seems to work. I think that 99% of the methods, properties, etc I ve seen all start with letters. I guess I ll
        Message 3 of 6 , Sep 15, 2005
        • 0 Attachment
          magic is set...

          search-forward " \\.[A-Za-z]"

          seems to work.

          I think that 99% of the methods, properties, etc I've seen all start
          with letters.

          I guess I'll just have to use the leading whitespace character.


          Thanks, Gadrin

          --- In jasspa@yahoogroups.com, Thomas Hundt <thundt@s...> wrote:
          > Suggestions:
          >
          > 1. Turn on "magic" mode in the buffer (right click on the modeline
          for
          > menu!). This enables regexp recognition in searches. (I leave
          this
          > enabled permanently.)
          >
          > 2. Use isearch-forward, and build/test your regular expression
          that way,
          > with immediate feedback.
          >
          > I take it you wish to match the beginning of line?
          > I used "^\W*\.\w+" just now to match the ".words". (That doesn't
          match
          > .OpenRecordset, though.)
          >
          > Good luck
          >
          > -Th
          >
          >
          >
          > Gadrin wrote:
          > > Is this even possible ?
          > >
          > > given the following buffer:
          > >
          > > With qdfBestSellers
          > > .Connect = "ODBC;DATABASE=pubs;UID=sa;PWD=;" & _
          > > "DSN=Publishers"
          > > .SQL = "SELECT title, title_id FROM titles " & _
          > > "ORDER BY ytd_sales DESC"
          > > Set rstTopSeller = .OpenRecordset()
          > > rstTopSeller.MoveFirst
          > > End With
          > >
          > > I'd like to match the "words"
          > >
          > > .Connect
          > > .SQL
          > > .OpenRecordset()
          > >
          > > but can't seem to using "\b\\." which I assume is due to the
          fact
          > > that the period character isn't considered a word character,
          so "\<"
          > > won't help either.
          > >
          > > It's quite possible that there won't be a space in front of the
          > > period in further tests, so I'd rather not use "\ \\." either.
          > >
          > > anybody have an ideas ?
          > >
          > >
        • Jon Green
          ... You need MAGIC mode on. Search for the regular expression . (Connect |SQL |OpenRecordSet() ) If you turn EXACT mode off you could search for
          Message 4 of 6 , Sep 15, 2005
          • 0 Attachment
            Gadrin wrote:
            > Is this even possible ?
            >
            > given the following buffer:
            >
            > With qdfBestSellers
            > .Connect = "ODBC;DATABASE=pubs;UID=sa;PWD=;" & _
            > "DSN=Publishers"
            > .SQL = "SELECT title, title_id FROM titles " & _
            > "ORDER BY ytd_sales DESC"
            > Set rstTopSeller = .OpenRecordset()
            > rstTopSeller.MoveFirst
            > End With
            >
            > I'd like to match the "words"
            >
            > .Connect
            > .SQL
            > .OpenRecordset()
            >
            > but can't seem to using "\b\\." which I assume is due to the fact
            > that the period character isn't considered a word character, so "\<"
            > won't help either.
            >
            > It's quite possible that there won't be a space in front of the
            > period in further tests, so I'd rather not use "\ \\." either.
            >
            > anybody have an ideas ?
            >

            You need MAGIC mode on.
            Search for the regular expression

            "\.\(Connect\|SQL\|OpenRecordSet()\)"

            If you turn EXACT mode off you could search for

            "\.\(connect\|sql\|openrecordset()\)"

            If you wanted to search for all "." words you could use:

            "\.\w+"

            Capitalised words:

            "\.\u\w+

            With no leading word character (i.e. white space only)

            "\B\.\w+"

            For command line then use one slash, for macros then use 2 slashes.
            For help look at the regularExpressions(2) manual page.

            Regards
            Jon.
          • Gadrin
            ... !force search-forward B . w+ Seems to do it. I did, I keep forgetting about the double slash in macros. Thanks, much!
            Message 5 of 6 , Sep 15, 2005
            • 0 Attachment
              > "\B\.\w+"
              >
              > For command line then use one slash, for macros then use 2 slashes.
              > For help look at the regularExpressions(2) manual page.
              >
              > Regards
              > Jon.

              !force search-forward "\\B\\.\\w+"

              Seems to do it.

              I did, I keep forgetting about the double slash in macros.

              Thanks, much!
            • Phillips, Steven
              In macros I recommend the use of command search-buffer rather than search-forward or search-backward as you can explicitly specify whether magic or exact mode
              Message 6 of 6 , Sep 15, 2005
              • 0 Attachment
                In macros I recommend the use of command search-buffer rather than
                search-forward or search-backward as you can explicitly specify whether
                magic or exact mode are to be used. It's a lot easier than
                setting/resetting the modes and more reliable than not bothering to set
                them.

                The command was introduced in the last release to address this problem.

                Steve

                > -----Original Message-----
                > From: jasspa@yahoogroups.com [mailto:jasspa@yahoogroups.com] On Behalf
                Of
                > Jon Green
                > Sent: Friday, September 16, 2005 12:18 AM
                > To: jasspa@yahoogroups.com
                > Subject: Re: [jasspa] RegExp Question
                >
                > Gadrin wrote:
                > > Is this even possible ?
                > >
                > > given the following buffer:
                > >
                > > With qdfBestSellers
                > > .Connect = "ODBC;DATABASE=pubs;UID=sa;PWD=;" & _
                > > "DSN=Publishers"
                > > .SQL = "SELECT title, title_id FROM titles " & _
                > > "ORDER BY ytd_sales DESC"
                > > Set rstTopSeller = .OpenRecordset()
                > > rstTopSeller.MoveFirst
                > > End With
                > >
                > > I'd like to match the "words"
                > >
                > > .Connect
                > > .SQL
                > > .OpenRecordset()
                > >
                > > but can't seem to using "\b\\." which I assume is due to the fact
                > > that the period character isn't considered a word character, so "\<"
                > > won't help either.
                > >
                > > It's quite possible that there won't be a space in front of the
                > > period in further tests, so I'd rather not use "\ \\." either.
                > >
                > > anybody have an ideas ?
                > >
                >
                > You need MAGIC mode on.
                > Search for the regular expression
                >
                > "\.\(Connect\|SQL\|OpenRecordSet()\)"
                >
                > If you turn EXACT mode off you could search for
                >
                > "\.\(connect\|sql\|openrecordset()\)"
                >
                > If you wanted to search for all "." words you could use:
                >
                > "\.\w+"
                >
                > Capitalised words:
                >
                > "\.\u\w+
                >
                > With no leading word character (i.e. white space only)
                >
                > "\B\.\w+"
                >
                > For command line then use one slash, for macros then use 2 slashes.
                > For help look at the regularExpressions(2) manual page.
                >
                > Regards
                > Jon.
                >
                >
                > ------------------------ Yahoo! Groups Sponsor
                >
                >
                ________________________________________________________________________
                __
                >
                > This is an unmoderated list. JASSPA is not responsible for the content
                of
                > any material posted to this list.
                >
                > To unsubscribe, send a mail message to
                >
                > mailto:jasspa-unsubscribe@yahoogroups.com
                >
                > or visit http://groups.yahoo.com/group/jasspa and
                > modify your account settings manually.
                >
                >
                >
                > Yahoo! Groups Links
                >
                >
                >
                >
              Your message has been successfully submitted and would be delivered to recipients shortly.