* Does word under cursor match pattern?
@ 2010-08-23 11:18 Paulo J. Matos
2010-08-23 11:56 ` Lennart Borgman
2010-08-23 12:37 ` Deniz Dogan
0 siblings, 2 replies; 5+ messages in thread
From: Paulo J. Matos @ 2010-08-23 11:18 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
I am trying to know if a word under the cursor matched a pattern
([Bb]-?[0-9]+). My idea was:
- Select region with word under cursor
- Transform region into string
- Apply regexp on string
This has one problem: I can't seem to find a function to transform a
region into a string. On the other hand maybe I can work with the region
directly.
Any tips on how to do this?
Cheers,
--
PMatos
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <mailman.6.1282562668.29657.help-gnu-emacs@gnu.org>]
* Re: Does word under cursor match pattern?
[not found] <mailman.6.1282562668.29657.help-gnu-emacs@gnu.org>
@ 2010-08-23 11:58 ` Marc Mientki
0 siblings, 0 replies; 5+ messages in thread
From: Marc Mientki @ 2010-08-23 11:58 UTC (permalink / raw)
To: help-gnu-emacs
Am 23.08.2010 13:18, schrieb Paulo J. Matos:
> Hi,
>
> I am trying to know if a word under the cursor matched a pattern
> ([Bb]-?[0-9]+).
>
> Any tips on how to do this?
This is a job for looking-at.
,----[ C-h f looking-at RET ]
| looking-at is a built-in function in `C source code'.
|
| (looking-at REGEXP)
|
| Return t if text after point matches regular expression REGEXP.
| This function modifies the match data that `match-beginning',
| `match-end' and `match-data' access; save and restore the match
| data if you want to preserve them.
`----
regards
Marc
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-08-23 12:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-23 11:18 Does word under cursor match pattern? Paulo J. Matos
2010-08-23 11:56 ` Lennart Borgman
2010-08-23 12:43 ` Paulo J. Matos
2010-08-23 12:37 ` Deniz Dogan
[not found] <mailman.6.1282562668.29657.help-gnu-emacs@gnu.org>
2010-08-23 11:58 ` Marc Mientki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).