Author Archives: admin

Advanced Regular Expression

String:

Ventilator Set:\n FiO2 ≤ 40%\nDrug use:\n NO\nWeaning trials:\n NO\nStop reason:\n neurologic factors\n備註:\n

Purpose

Find the second \n and replace it with another character

Solution

https://regex101.com/r/t9gozM/1

Pattern Explanation: 在\n後面找一個最近的\n或是結尾之間的字串

Notes:

  • (?:)
    括號裡面的內容不產生指標($1之類的)
  • ^
    一行的開始
  • $
    一行的結束
  • (?=p)
    正前向聲明,要求接下來的字元都與樣式p相符,但是不包括比對中的那些字元
  • (?!p)
    反前向聲明,要求接下來的字元不與樣式p相符
  • 重複字元(如*)後加上? – 非貪婪的重複比對
    /a+/
    /a+?/ -> 只符合一個以上的字母a

Image Library – intervention/image

Official Site:

http://image.intervention.io/getting_started/installation

Resize and Crop Example:

 

Guzzle usages

Basic

Get raw response

Reference:

Select a File (MP4) in Laravel Filemanager

By default, it will download the file when you click on the file. You have to revise a view file to replace onclick listener with “useFile”.

/vendor/unisharp/laravel-filemanager/src/views/grid-view.blade.php

Change Mysql (MariaDB) for table name lowercase

Stop Mysql service

  • run services.msc to open windows service manager
  • Stop MySQL service

Update my.ini (C:\Program Files\MariaDB 10.3\data\my.ini)

Add lower_case_table_names = 2

Start MySQL

  • Stop MySQL service

Reference:

Upload File to S3 using Laravel

Local file

Other related helper functions

 

Custom Usage of Laravel Filemanager

HTML

Javascript (lfm_app.js):

Usage: