fix RegExp bug ,add platform detection.