Function: org-re-property

org-re-property is a byte-compiled function defined in org.el.gz.

Signature

(org-re-property PROPERTY &optional LITERAL ALLOW-NULL VALUE)

Documentation

Return a regexp matching a PROPERTY line.

When optional argument LITERAL is non-nil, do not quote PROPERTY. This is useful when PROPERTY is a regexp. When ALLOW-NULL is non-nil, match properties even without a value.

Match group 3 is set to the value when it exists. If there is no value and ALLOW-NULL is non-nil, it is set to the empty string.

With optional argument VALUE, match only property lines with that value; in this case, ALLOW-NULL is ignored. VALUE is quoted unless LITERAL is non-nil.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defsubst org-re-property (property &optional literal allow-null value)
  "Return a regexp matching a PROPERTY line.

When optional argument LITERAL is non-nil, do not quote PROPERTY.
This is useful when PROPERTY is a regexp.  When ALLOW-NULL is
non-nil, match properties even without a value.

Match group 3 is set to the value when it exists.  If there is no
value and ALLOW-NULL is non-nil, it is set to the empty string.

With optional argument VALUE, match only property lines with
that value; in this case, ALLOW-NULL is ignored.  VALUE is quoted
unless LITERAL is non-nil."
  (concat
   "^\\(?4:[ \t]*\\)"
   (format "\\(?1::\\(?2:%s\\):\\)"
	   (if literal property (regexp-quote property)))
   (cond (value
	  (format "[ \t]+\\(?3:%s\\)\\(?5:[ \t]*\\)$"
		  (if literal value (regexp-quote value))))
	 (allow-null
	  "\\(?:\\(?3:$\\)\\|[ \t]+\\(?3:.*?\\)\\)\\(?5:[ \t]*\\)$")
	 (t
	  "[ \t]+\\(?3:[^ \r\t\n]+.*?\\)\\(?5:[ \t]*\\)$"))))