Skip to content

Commit

Permalink
hotfix: add warning message if regex is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhou committed Aug 22, 2024
1 parent 2f796f8 commit 67e86ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion code/Home.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"""

__ver__ = 'v2.5.0'
__ver__ = 'v2.5.1'

import pandas as pd
import streamlit as st
Expand Down
5 changes: 4 additions & 1 deletion code/util/streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,10 @@ def filter_dataframe(df: pd.DataFrame,
)

if user_text_input:
df = df[df[column].astype(str).str.contains(user_text_input)]
try:
df = df[df[column].astype(str).str.contains(user_text_input, regex=True)]
except:
st.warning('Wrong regular expression!')

return df

Expand Down

0 comments on commit 67e86ac

Please sign in to comment.