开发过程中使用到的正则表达式

2019-10-30  本文已影响0人  CAICAI0

全局正则替换添加一句代码
OC

code
     [self.viewController presentViewController:alertController animated:YES completion:nil];

正则:([\s]*)\[([\S]+)[\s]+presentViewController[\s]*:[\s]*([\S]+)[\s]+animated[\s]*:[\s]*([\S]+)[\s]+completion[\s]*:[\s]*([\S]+)[\s]*\]
替换:$1$3.modalPresentationStyle = UIModalPresentationFullScreen;$1[$2 presentViewController:$3 animated:$4 completion:$5]

code
    alertController.modalPresentationStyle = UIModalPresentationFullScreen; 
    [self.viewController presentViewController:alertController animated:YES completion:nil];

swift

let reader = nv.viewControllers.first as? JKJReaderController {
reader.docId = news.document.docId
nv.modalPresentationStyle = .fullScreen;
from.present(nv ,animated: true,completion: nil)

正则:([\s]*)([\S]*)present[\s]*\([\s]*([\S]+)[\s]*,[\s]*animated[\s]*:[\s]*([\S]+)[\s]*,[\s]*completion[\s]*:[\s]*([\S]+)[\s]*\)
替换:$1$3.modalPresentationStyle = .fullScreen $1$2present($3 ,animated: $4,completion: $5)

let reader = nv.viewControllers.first as? JKJReaderController {
reader.docId = news.document.docId
nv.modalPresentationStyle = .fullScreen 
from.present(nv ,animated: true,completion: nil)
上一篇 下一篇

猜你喜欢

热点阅读