Periodic visiting pattern (periodic pattern) means a person revisits a place to conduct a specific activity periodically (possibly non-continuous), in which the time interval could differ slightly from one occurrence to the other (possibly unstable). Perceiving periodic patterns is the key to understanding residents' daily needs and living range, which provides evidence for more reasonable resource allocation and urban planning. For example, if a group of people visits medical centres continuously and stably at short intervals, the allocation of medical resources should lean toward this group of people. However, previous methods are too rigid for detecting periodic patterns. They cannot distinguish the stability and continuity of periodic patterns, resulting in the inability to differentiate the significance level of certain patterns to some people and the omission of some vital but imperfect patterns. In addition, previous studies ignore analysing the heterogeneity of periodic patterns across different places and age groups, which is crucial to the spatial and personalized analysis of daily needs. Thus, we first design a novel method to flexibly detect the periodic pattern from the trajectory data. Then, we compare the proportions of each type of activity supported by the corresponding built environment among different places and age groups. With the mobile phone data during three months in Beijing, we found significant imbalances in the spatial scope of periodic patterns and differences in periodic patterns across different age groups, reflecting the residents’ diverse needs for each functional area and the potential inconvenience caused by the irrational spatial distribution of resources.