I found it very hard to write a regex to match j numbers. A simple
regex to match positive decimal integer is relatively easy,

  d\+      

but from page constants in J dictionary,

The form of a numeric constant defined and illustrated in Part I is elaborated 
by the use of further letters, as in 2r3 for
two-thirds, 2p1 for two π, and 2e3p1 for 2000 π. The complete scheme of numeric 
constants obeys the following hierarchy:

     .      The decimal point is obeyed first
     _      The negative sign is obeyed next
     e      Exponential (scientific) notation
ad ar j     Complex (magnitude and angle) in degrees or radians; Complex number
    p x     Numbers based on pi (o.1) and on Euler’s number (the exponential ^1)
     b      Base value (using a to z for 10 to 35)

Moreover, digits with a trailing x denote an extended precision integer, and 
digits followed by an r followed by further
digits denote a rational number. See Section II G.

Does anyone know how to write the regex for it?

Thanks,

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩137 劉長卿  新年作
    鄉心新歲切  天畔獨潸然  老至居人下  春歸在客先
    嶺猿同旦暮  江柳共風煙  已似長沙傅  從今又幾年
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to