Content deleted Content added
mNo edit summary |
mNo edit summary |
||
Line 12:
txt.value = txt.value.replace(/°\s?(celsius)/gi, '°C');
txt.value = txt.value.replace(/(\d)\s?(°[CF])/g, '$1 $2');
//
txt.value = txt.value.replace(/celsius/gi, 'Celsius');
txt.value = txt.value.replace(/celcius/gi, 'Celsius');
Line 22 ⟶ 23:
txt.value = txt.value.replace(/³/g, '³');
txt.value = txt.value.replace(/(\d)\s?(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|μ|µ|n|p|f|a|z|y)?\s?(Ω|ohm|Ohm)s?([\s,.;:\)\(\\/)])/g, '$1 $2Ω$4');
Line 37 ⟶ 38:
txt.value = txt.value.replace(/(\d)\-(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|μ|µ|n|p|f|a|z|y)?hz/gi, '$1 $2Hz');
//metre: space before 'm' only when lower case▼
txt.value = txt.value.replace(/(\d)\s?
txt.value = txt.value.replace(/(\d)\-
txt.value = txt.value.replace(/(\d) kms?([\s,.;:\)\(\\/)])/gi, '$1 km$2');▼
// kilometre
txt.value = txt.value.replace(/(\d)\s?sq\.?\s?kms?/gi, '$1 km²');
txt.value = txt.value.replace(/sq\.?\s?kms?/gi, 'km²');
Line 47 ⟶ 52:
txt.value = txt.value.replace(/m²\.\)/gi, 'm²)');
//
txt.value = txt.value.replace(/km\/hr/gi, 'km/h');
txt.value = txt.value.replace(/kph/gi, 'km/h');
Line 57 ⟶ 62:
txt.value = txt.value.replace(/(\d) km\/h/gi, '$1 km/h');
//
// millilitre
txt.value = txt.value.replace(/(\d)\s?ft\/second/gi, '$1 ft/s');
txt.value = txt.value.replace(/(\d)\s?ft\/sec(\W)/gi, '$1 ft/s$2');
txt.value = txt.value.replace(/(\d)\s?m\/second/gi, '$1 m/s');
txt.value = txt.value.replace(/(\d)\s?m\/sec(\W)/gi, '$1 m/s$2');
txt.value = txt.value.replace(/(\d)\s?km\/sec(\W)/gi, '$1 km/s$2');
// kilogram
// Space before horsepower symbol▼
txt.value = txt.value.replace(/(\d)\s?
txt.value = txt.value.replace(/(\d)\
▲ txt.value = txt.value.replace(/(\d)\s?shp/gi, '$1 shp');
//
//txt.value = txt.value.replace(/(
▲ txt.value = txt.value.replace(/(\d)\-cc([\s,.;:\)\(\\/)])/gi, '$1 cc$2');
// kilowatt
txt.value = txt.value.replace(/(\d)\s?ft([\s,.;:\)\(\\/)])/gi, '$1 ft$2');▼
txt.value = txt.value.replace(/(\d)
txt.value = txt.value.replace(/(\d)\
▲ txt.value = txt.value.replace(/(\d)\-rpm/gi, '$1 rpm');
▲ //space before 'm' only when lower case
txt.value = txt.value.replace(/(\d)\s?m([\s,.;:\)\(\\/)])/g, '$1 m$2');▼
▲ //txt.value = txt.value.replace(/(\d)\s?ml([\s,.;:\)\(\\/)])/g, '$1 ml$2');
▲ //txt.value = txt.value.replace(/(\d)\-ml([\s,.;:\)\(\\/)])/g, '$1 ml$2');
▲ txt.value = txt.value.replace(/(\d)\s?m(\W)/g, '$1 m$2');
▲ txt.value = txt.value.replace(/(\d)\s?m(\w?\W)/g, '$1 m$2');
//
txt.value = txt.value.replace(/m\.p\.h\./gi, 'mph');
txt.value = txt.value.replace(/mph([\s,.;:\)\(\\/)])/gi, 'mph$1');
Line 92 ⟶ 95:
txt.value = txt.value.replace(/(\d)\-mph/gi, '$1 mph');
//
txt.value = txt.value.replace(/(\d)\s?lbs?/gi, '$1 lb');
txt.value = txt.value.replace(/(\d\+?)\s?lbs?/gi, '$1 lb');
Line 98 ⟶ 101:
txt.value = txt.value.replace(/(\d)\s?(\[\[lbs\]\])/gi, '$1 \[\[Pound (mass)|lb\]\]');
//
//txt.value = txt.value.replace(/(N•m)/gi, 'N·m');▼
▲ // kilowatts
txt.value = txt.value.replace(/(\d)\s?kW([\s,.;:\)\(\\/)])/g, '$1 kW$2');▼
txt.value = txt.value.replace(/(\d)\-kW([\s,.;:\)\(\\/)])/g, '$1 kW$2');▼
▲ // foot pounds
txt.value = txt.value.replace(/ft[ -.·•\/]lb[fs]/gi, 'ft·lbf');▼
txt.value = txt.value.replace(/ft[ -.·•\/]lbf/gi, 'ft·lbf');▼
txt.value = txt.value.replace(/ft[ -.·•\/]lbff/gi, 'ft·lbf');▼
txt.value = txt.value.replace(/ft[ -.·•\/]lb\s/gi, 'ft·lbf ');▼
//the next two suspended until solution is found for wing loading (i.e. pounds per square foot)▼
//txt.value = txt.value.replace(/lb[fs][ -.•\/]ft/gi, 'ft·lbf');▼
//txt.value = txt.value.replace(/lb[ -.•\/]ft/gi, 'ft·lbf');▼
txt.value = txt.value.replace(/([^;°h][^;°h]\s)(\d{1,4})\s?['’]\s?(\d{1,2})\s?["”][^NESW]/g, '$1$2 ft $3 in');
txt.value = txt.value.replace(/([\(\|]\d{1,4})\s?['’]\s?(\d{1,2})\s?["”][^NESW]/g, '$1 ft $2 in');
txt.value = txt.value.replace(/(\d)\s?ft\s(\d{1,2})\s?in/gi, '$1 ft $2 in');
▲ // square feet
txt.value = txt.value.replace(/
txt.value = txt.value.replace(/ft\.\)/gi, 'ft)');
//
// yard
txt.value = txt.value.replace(/(\d)\s?yds(\W)/gi, '$1 yd$2');
txt.value = txt.value.replace(/(\d) yds(\W)/gi, '$1 yd$2');
txt.value = txt.value.replace(/sq\.?\s?yds?/gi, 'sq yd');
txt.value = txt.value.replace(/yd\.\)/gi, 'yd)');
// square mile
// foot pound
▲ txt.value = txt.value.replace(/ft[ -.·•\/]lb[fs]/gi, 'ft·lbf');
▲ txt.value = txt.value.replace(/ft[ -.·•\/]lbf/gi, 'ft·lbf');
▲ txt.value = txt.value.replace(/ft[ -.·•\/]lbff/gi, 'ft·lbf');
▲ txt.value = txt.value.replace(/ft[ -.·•\/]lb\s/gi, 'ft·lbf ');
▲ //the next two suspended until solution is found for wing loading (i.e. pounds per square foot)
▲ //txt.value = txt.value.replace(/lb[fs][ -.•\/]ft/gi, 'ft·lbf');
▲ //txt.value = txt.value.replace(/lb[ -.•\/]ft/gi, 'ft·lbf');
// Give digital value a percent symbol '%' instead of word
Line 132 ⟶ 134:
txt.value = txt.value.replace(/(\d)\-per ?cent([^aei])/gi, '$1%$2');
//
txt.value = txt.value.replace(/(\d)\s?kts(
txt.value = txt.value.replace(/(\d)\s?shp/gi, '$1 shp');
// rpm
txt.value = txt.value.replace(/(\d)\s?rpm/gi, '$1 rpm');
// decibel
//
txt.value = txt.value.replace(/([KkMmGg])(bps|bits?\/s|b\/s)/g, '$1bit/s');
txt.value = txt.value.replace(/(\d)\s?(bps)/gi, '$1 bit/s');
//
txt.value = txt.value.replace(/([KkMmGg])(Bps|bytes?\/s)/g, ' $1B/s');
//
txt.value = txt.value.replace(/K(bit|B)\/s/g, 'k$1/s');
txt.value = txt.value.replace(/m(bit|B)\/s/g, 'M$1/s');
txt.value = txt.value.replace(/g(bit|B)\/s/g, 'G$1/s');
//
txt.value = txt.value.replace(/(\d)\s?(k|M|G)(bit|B)/g, '$1 $2$3');
// Common error with bits and bytes
txt.value = txt.value.replace(/mibi(bit|byte)/g, 'mebi$1');
|